Skip to content

Instantly share code, notes, and snippets.

@zenangst
Created February 13, 2018 18:00
Show Gist options
  • Save zenangst/73dcdd19f46b4dc5b3d2b4ccb00d162b to your computer and use it in GitHub Desktop.
Save zenangst/73dcdd19f46b4dc5b3d2b4ccb00d162b to your computer and use it in GitHub Desktop.
Syncing UIView animations - Framework implementation
let animationDuration: TimeInterval? = subviewsInLayoutOrder
.flatMap({ $0.layer.resolveAnimationDuration }).first ?? duration
if let duration = animationDuration {
let options: UIViewAnimationOptions = [.allowUserInteraction, .beginFromCurrentState]
UIView.animate(withDuration: duration, delay: 0.0, options: options, animations: {
self.runLayoutSubviewsAlgorithm()
})
} else {
runLayoutSubviewsAlgorithm()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment