In Swift 3, method reference for: func ratingButtonTapped(button: UIButton)
becomes ratingButtonTapped(button:)
.
So, using #selector(RatingControl.ratingButtonTapped(button:))
also work.
And if you want to keep #selector(RatingControl.ratingButtonTapped(_:))
, then you need to declare the ratingButtonTapped
method as:
func ratingButtonTapped(_ button: UIButton) { //<- `_`
print("Button pressed đź‘Ť")
}
And if you have only one ratingButtonTapped
method in the class, you can address the selector as #selector(RatingControl.ratingButtonTapped)
or simply (from inside RatingControl
class) #selector(ratingButtonTapped)
.