mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 13:15:35 +03:00
Using custom delay queue
This commit is contained in:
parent
584adbf9f4
commit
ccef91fe08
@ -1,12 +1,17 @@
|
||||
|
||||
let animationProducer = AnimationProducer()
|
||||
|
||||
class AnimationProducer {
|
||||
|
||||
let delayQueue = dispatch_queue_create("delay_queue", DISPATCH_QUEUE_CONCURRENT)
|
||||
|
||||
func addAnimation(animation: BasicAnimation, withoutDelay: Bool = false) {
|
||||
|
||||
if animation.delay > 0.0 && !withoutDelay {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(animation.delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), {
|
||||
self.addAnimation(animation, withoutDelay: true)
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(animation.delay * Double(NSEC_PER_SEC))), delayQueue, {
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
self.addAnimation(animation, withoutDelay: true)
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user