Skip to content

Instantly share code, notes, and snippets.

@zenangst
Created February 13, 2018 17:58
Show Gist options
  • Save zenangst/f43a6feef2f0f09f82aed81722f561de to your computer and use it in GitHub Desktop.
Save zenangst/f43a6feef2f0f09f82aed81722f561de to your computer and use it in GitHub Desktop.
Syncing UIView animations - CALayer extension
import UIKit
extension CALayer {
/// Resolve animation duration of the first animation using animation keys.
var resolveAnimationDuration: CFTimeInterval? {
if let firstKey = animationKeys()?.first,
let animation = animation(forKey: firstKey) {
return animation.duration
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment