Repository navigation
add timer into closure - #8
phamquochoan wants to merge 1 commit into
Conversation
|
Yes, we will have to write that, or { _ in ... } With |
|
Maybe we can overload every with a second variant that doesn't take any arguments in its closure? Can you check if it's possible to make the timer argument optional in some way? |
|
Theorically, yes. But I'm afraid of the error Sometimes I cannot use it likes I'll give it a try. |
|
Thanks, hopefully Swift can handle this case :) |
|
Best I can do is: NSTimer.after(5.0.seconds) { // it works
log("abc")
}
NSTimer.after(5.0.seconds) { (timer: NSTimer!) -> Void in // this one works too
log("abc")
}
NSTimer.after(5.0.seconds) { timer in // ambiguous
log("abc")
}I have to doubled every function in souce code file, and it looks ugly because Objective-C doesn't handle function overload as well as swift. |

So people can call invalidate() inside closure