Async/Await - Run after delay

I've been keeping an eye on a lot of the async/await that has been coming though over the past few months and have played around with the latest toolchains briefly. So far it's looking pretty great, hats off to everyone who has contributed.

One operation that I've used quite a lot for animations and 'smoke and mirrors' type events with GCD is triggering a closure to happen after a delay. I may have missed the discussions around this, but as far as I can see this isn't something that's been covered.

At the moment the area where this I would assume should 'fit' is as part of Task. We currently have the runDetached(priority: ....) methods but it feels like there should be some kind of runDetached(after: TimeInterval, priority: ...) method.

Maybe I'm just misunderstanding how things fit together or have missed something in the proposals, but I'm pretty sure we don't want to start adding sleep(...) everywhere. If I've totally missed the mark then pointing me in the right direction would be great.

Terms of Service

Privacy Policy

Cookie Policy