Conversation
|
But it you do that, then you'll have to write { timer in ... } when defining a closure, no? |
|
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. |
|
Done on master. |
So people can call invalidate() inside closure