Created
February 13, 2018 17:58
-
-
Save zenangst/f43a6feef2f0f09f82aed81722f561de to your computer and use it in GitHub Desktop.
Syncing UIView animations - CALayer extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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