I\'m trying to convert my project\'s source code from Swift 3 to Swift 4. One warning Xcode is giving me is about my selectors.
For instance, I add a target to a butt
As Apple Official Documentation. you need to use @objc to call your Selector Method.
In Objective-C, a selector is a type that refers to the name of an Objective-C method. In Swift, Objective-C selectors are represented by the
Selector
structure, and can be constructed using the#selector
expression. To create a selector for a method that can be called from Objective-C, pass the name of the method, such as#selector(MyViewController.tappedButton(sender:))
. To construct a selector for a property’s Objective-C getter or setter method, pass the property name prefixed by thegetter:
orsetter:
label, such as#selector(getter: MyViewController.myButton)
.