Add Button Response in Swift

PHOTO EMBED

Saved by @mishka #ios #swift

@IBAction func doSomething()
@IBAction func doSomething(sender: UIButton)
@IBAction func doSomething(sender: UIButton, forEvent event: UIEvent)
content_copyCOPY

You connect a button to your action method using the addTarget(_:action:for:) method or by creating a connection in Interface Builder. The signature of an action method takes one of three forms, which are listed in Listing 1. Choose the form that provides the information that you need to respond to the button tap.

https://developer.apple.com/documentation/uikit/uibutton