I\'m trying to create an NSTimer
in Swift
but I\'m having some trouble.
NSTimer(timeInterval: 1, target: self, selector: test(), us
Also, if your (Swift) class does not descend from an Objective-C class, then you must have a colon at the end of the target method name string and you must use the @objc property with your target method e.g.
var rightButton = UIBarButtonItem(title: "Title", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("method"))
@objc func method() {
// Something cool here
}
otherwise you will get a "Unrecognised Selector" error at runtime.