@IBActions for buttons are disabled when added to code - Swift, Xcode 8

I am currently experiencing a problem in Xcode 8, where throughout my project, when I try to add IBAction to a button, the action is disabled (open circle) in the code.

This problem occurs in only one project; I tested other projects, and actions were added correctly (vicious circle).

It would be very helpful to accept any help in solving this problem.

+4
source share
1 answer

For Xcode 8, please check your action method as

@IBAction func PrintAgain(_ sender: UIButton) {
}

add _ before the sender because if you remove _ from a function, xcode adds WithSender automatic for the function name

+4

Source: https://habr.com/ru/post/1651383/


All Articles