Skip to content

Instantly share code, notes, and snippets.

@rchatham
Created December 6, 2016 01:59
Show Gist options
  • Save rchatham/cf41650db3091111b28d36ca1da2bf9f to your computer and use it in GitHub Desktop.
Save rchatham/cf41650db3091111b28d36ca1da2bf9f to your computer and use it in GitHub Desktop.
Chaining animations with SwiftyAnimate
// Escape the Pyramid of DOOM!
Animate(duration: time) { [unowned self] in
// animation
self.animationFunction()
}.do { [unowned self] in
// non-animation function
self.nonAnimationFunction()
}.then(duration: time) { [unowned self] in
// animation
self.animationFunction()
}.wait { [unowned self] resume in
// function that takes time
self.functionThatTakesTime {
resume()
}
}.then(duration: time) { [unowned self] in
// animation
self.animationFunction()
}.then(duration: time) { [unowned self] in
// animation
self.animationFunction()
}.perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment