Swift 3
Any , if you know that the sender is never nil .
@IBAction func buttonClicked(sender : Any) { println("Button was clicked", sender) }
Any? if the sender may be nil .
@IBAction func buttonClicked(sender : Any?) { println("Button was clicked", sender) }
Swift 2
AnyObject if you know that the sender is never nil .
@IBAction func buttonClicked(sender : AnyObject) { println("Button was clicked", sender) }
AnyObject? if the sender may be nil .
@IBAction func buttonClicked(sender : AnyObject?) { println("Button was clicked", sender) }
Doug Richardson Jun 03 '14 at 1:14
source share