Skip to content

Instantly share code, notes, and snippets.

@rchatham
Created December 6, 2016 01:56
Show Gist options
  • Save rchatham/d1d0989735fdd5daad3b89b8ce1f04b3 to your computer and use it in GitHub Desktop.
Save rchatham/d1d0989735fdd5daad3b89b8ce1f04b3 to your computer and use it in GitHub Desktop.
Chaining UIView animations
UIView.animate(withDuration: time, animations: { [unowned self] in
// animation
self.animationFunction()
}) { [unowned self] success in
// non-animation function
self.nonAnimationFunction()
UIView.animate(withDuration: time, animations: {
// animation
self.animationFunction()
}) { success in
// function that takes time
self.functionThatTakesTime {
UIView.animate(withDuration: time, animations: {
// animation
self.animationFunction()
}) { success in
UIView.animate(withDuration: time, animations: {
// animation
self.animationFunction()
})
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment