I am getting following warning on updating my code to swift 4
implicit Objective-C entrypoint -[development.ASTodayViewController tableView:heightForHeaderInSection:] is deprecated and will be removed in Swift 4
How to resolved that ?
I have table delegate method as
func tableView(_ tableView: UITableView,
heightForHeaderInSection section: Int) -> CGFloat {
return 40.0
}
implicit Objective-C entrypoint mainly refer to the @objc
inferences that were used implicitly before Swift 4.
But Swift 4, doesn't allow these @objc
implicit inferences.
Before Swift 4, the compiler made some Swift declarations automatically available to Objective-C. For example, if one subclassed from NSObject, the compiler created Objective-C entry points for all methods in such classes. The mechanism is called @objc inference.
In Swift 4, such automatic @objc inference is deprecated because it is costly to generate all those Objective-C entry points. When “Swift 3 @objc Inference” setting is set to “On”, it allows the old code to work. However, it will show deprecation warnings that need to be addressed. It is recommended to “fix” these warnings and switch the setting to “Default”, which is the default for new Swift projects.
If you still want to use it, you can set Swift 3 @objc Inference
in Build Settings
to On
.
Add some more code to the question so that I can tell you the exact issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With