Skip to content

Commit 43a4164

Browse files
committed
'Cancel' for PromiseKit --
* Delete CancellableGuarantee and all its usages * In PromiseKit Core: instead of using additional functions and methods with the 'CC' suffix, created a new 'cancellable' function to wrap any Promise or Guarantee * In the extensions: Rename methods with 'CC' suffix to 'cancellable' prefix (may revisit this) * Fix the CancellableCatchable 'recover' methods to properly handle cancellation errors * Added an 'afterTask' property to Guarantee, to keep track of the task for calls to 'after'. This way the timer can be appropriately cancelled if the returned Guarantee is passed to the new 'cancellable' function. (may revisit this) * Update all cancellable tests for the cancellable API changes
1 parent 2f81beb commit 43a4164

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/UIViewPropertyAnimator+Promise.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension UIViewPropertyAnimator: CancellableTask {
2525
return (state == .inactive) && (fractionComplete < 1.0)
2626
}
2727

28-
public func startAnimationCC(_: PMKNamespacer) -> CancellablePromise<UIViewAnimatingPosition> {
28+
public func cancellableStartAnimation(_: PMKNamespacer) -> CancellablePromise<UIViewAnimatingPosition> {
2929
return CancellablePromise(task: self) {
3030
addCompletion($0.fulfill)
3131
startAnimation()

Tests/TestUIViewPropertyAnimator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension UIViewPropertyAnimatorTests {
3131
let animator = UIViewPropertyAnimator(duration: 0.1, curve: .easeIn, animations: { [weak self] in
3232
ex1.fulfill()
3333
})
34-
let p = animator.startAnimationCC(.promise).done { _ in
34+
let p = animator.cancellableStartAnimation(.promise).done { _ in
3535
XCTFail()
3636
}.catch(policy: .allErrors) { error in
3737
error.isCancelled ? ex2.fulfill() : XCTFail("Error: \(error)")

0 commit comments

Comments
 (0)