Skip to content

Commit

Permalink
'Cancel' for PromiseKit -- provides the ability to cancel promises an…
Browse files Browse the repository at this point in the history
…d promise chains
  • Loading branch information
dougzilla32 committed Oct 7, 2018
1 parent 7393458 commit 82f57a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "dougzilla32/PromiseKit" "288f7fbabc0b33c558bf908a3a0770693223d4e0"
github "dougzilla32/PromiseKit" "087b3cf470890ff9ea841212e2f3e285fecf3988"
7 changes: 5 additions & 2 deletions Sources/UIViewPropertyAnimator+Promise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import PromiseKit
import UIKit

@available(iOS 10, tvOS 10, *)
public extension UIViewPropertyAnimator: CancellableTask {
public extension UIViewPropertyAnimator {
func startAnimation(_: PMKNamespacer) -> Guarantee<UIViewAnimatingPosition> {
return Guarantee<UIViewAnimatingPosition>(cancellableTask: self) {
addCompletion($0)
startAnimation()
}
}

}

@available(iOS 10, tvOS 10, *)
extension UIViewPropertyAnimator: CancellableTask {
public func cancel() {
stopAnimation(true)
}
Expand Down

0 comments on commit 82f57a6

Please sign in to comment.