On the line gives an error, how to fix it? no method declared with objective-c selector "resetAction"

 if let resetButton = menu.subviews.last as? UIButton { resetButton.addTarget(self, action: Selector("resetAction"), forControlEvents: .TouchUpInside) } view.addSubview(menu) func resetAction() { } 

    1 answer 1

    In swift2.2 / xcode7.3, the declaration of selectors has changed.

    You instead of Selector("resetAction") should write #selector(self.resetAction)

    • If I write this, I get the error "Value of type 'Scene' has no member 'resetAction'" - Leci
    • Well, apparently, instead of self, you need something else (the name of the class in which there is a resetAction) - Max Mikheyenko