How can I deal with @objc inference deprecation with #selector() in Swift 4?

后端 未结 5 1638
遥遥无期
遥遥无期 2020-11-22 04:59

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

5条回答
  •  别那么骄傲
    2020-11-22 05:41

    As already mentioned in other answers, there is no way to avoid the @objc annotation for selectors.

    But warning mentioned in the OP can be silenced by taking following steps:

    1. Go to Build Settings
    2. Search for keyword @objc
    3. Set the value of Swift 3 @objc interface to Off

    below is the screenshot that illustrates the above mentioned steps:

    Hope this helps

提交回复
热议问题