Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 546 Bytes

File metadata and controls

22 lines (16 loc) · 546 Bytes

Swift: Selector syntax sugar

Objective-C developers be jelly

Medium post

Swift: Selector syntax sugar

tl;dr

Turn this:

let button = UIButton(type: .System)
button.addTarget(self, action: #selector(ViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside)

Into this:

let button = UIButton(type: .System)
button.addTarget(self, action: .buttonTapped, forControlEvents: .TouchUpInside)