When do we need a button to send an argument to Swift?

When connecting a button in Xcode as @IBAction func, we can choose between Arguments: Sender or None.

When do we choose Sender and None?

+2
source share
1 answer

Well, if the action method needs to know which button called it or can use any of the button properties, you need to pass the sender (button) to the method.

, "+" "-". performCalculation(sender: NSButton), ( title), .

, , , , , clearInput(), - , ( , ).

, . afaik. , .

+5

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


All Articles