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

后端 未结 5 1733
遥遥无期
遥遥无期 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:49

    If you need objective c members in your view controller just add @objcMembers at the top of the view controller. And you can avoid this by adding IBAction in your code.

    @IBAction func buttonAction() {
    
    }
    

    Make sure to connect this outlet in storyboard.

提交回复
热议问题