Finally, true is true. In his answer above, he pointed me in the right direction, proposing to Invokersubclass NSObject.
, . , , Invoker, , . , , . , :
class UIGestureRecognizerWithClosure: NSObject {
var closure:() -> ()
init(view:UIView, nizer: UIGestureRecognizer, closure:() -> ()) {
self.closure = closure
super.init()
view.addGestureRecognizer(nizer)
nizer.addTarget(self, action: "invokeTarget:")
}
func invokeTarget(nizer: UIGestureRecognizer) {
self.closure()
}
}
, :
var swipeRight = UISwipeGestureRecognizer()
swipeRight.direction = UISwipeGestureRecognizerDirection.Right
swipeWrapper = UIGestureRecognizerWithClosure(view: self, nizer:swipeRight) {
println("Hi from the gesture closure")
}