Skip to content

Instantly share code, notes, and snippets.

@Appletone
Created November 8, 2015 08:58
Show Gist options
  • Save Appletone/7a15193636377b0b8a67 to your computer and use it in GitHub Desktop.
Save Appletone/7a15193636377b0b8a67 to your computer and use it in GitHub Desktop.
extension WKInterfaceController {
func animateWithDuration(duration: NSTimeInterval, animations: () -> Void, completion: (() -> Void)?) {
animateWithDuration(duration, animations: animations)
let delay = dispatch_time(DISPATCH_TIME_NOW, Int64(duration * Double(NSEC_PER_SEC)))
dispatch_after(delay, dispatch_get_main_queue()) {
completion?()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment