Changes in new versions / Swift 2.2

// *** before: ***
// the method was named by a string; a typo or a rename was found only
// when the button was tapped, and the application crashed there
button.addTarget(self, action: "buttonTapped:",
                 forControlEvents: .TouchUpInside)
let timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self,
                 selector: "tick", userInfo: nil, repeats: true)

// *** in version 2.2: ***
button.addTarget(self, action: #selector(buttonTapped(_:)),
                 forControlEvents: .TouchUpInside)
let timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self,
                 selector: #selector(tick), userInfo: nil, repeats: true)

// the compiler checks that such a method exists and is visible to Objective-C
func buttonTapped(sender: AnyObject) { }
func tick() { }

// when two methods share a name, the one is picked by its type
let action = #selector(((tick) as () -> Void))