Add PromiseKit dependency
- Added PromiseKit dependency
This commit is contained in:
40
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/CALayer+AnyPromise.h
vendored
Normal file
40
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/CALayer+AnyPromise.h
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// CALayer+AnyPromise.h
|
||||
//
|
||||
// Created by María Patricia Montalvo Dzib on 24/11/14.
|
||||
// Copyright (c) 2014 Aluxoft SCP. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
|
||||
/**
|
||||
To import the `CALayer` category:
|
||||
|
||||
use_frameworks!
|
||||
pod "PromiseKit/QuartzCore"
|
||||
|
||||
Or `CALayer` is one of the categories imported by the umbrella pod:
|
||||
|
||||
use_frameworks!
|
||||
pod "PromiseKit"
|
||||
|
||||
And then in your sources:
|
||||
|
||||
@import PromiseKit;
|
||||
*/
|
||||
@interface CALayer (PromiseKit)
|
||||
|
||||
/**
|
||||
Add the specified animation object to the layer’s render tree.
|
||||
|
||||
@return A promise that thens two parameters:
|
||||
|
||||
1. `@YES` if the animation progressed entirely to completion.
|
||||
2. The `CAAnimation` object.
|
||||
|
||||
@see addAnimation:forKey
|
||||
*/
|
||||
- (AnyPromise *)promiseAnimation:(CAAnimation *)animation forKey:(NSString *)key;
|
||||
|
||||
@end
|
36
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/CALayer+AnyPromise.m
vendored
Normal file
36
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/CALayer+AnyPromise.m
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// CALayer+PromiseKit.m
|
||||
//
|
||||
// Created by María Patricia Montalvo Dzib on 24/11/14.
|
||||
// Copyright (c) 2014 Aluxoft SCP. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/CAAnimation.h>
|
||||
#import "CALayer+AnyPromise.h"
|
||||
|
||||
@interface PMKCAAnimationDelegate : NSObject <CAAnimationDelegate> {
|
||||
@public
|
||||
PMKResolver resolve;
|
||||
CAAnimation *animation;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation PMKCAAnimationDelegate
|
||||
|
||||
- (void)animationDidStop:(CAAnimation *)ignoreOrRetainCycleHappens finished:(BOOL)flag {
|
||||
resolve(PMKManifold(@(flag), animation));
|
||||
animation.delegate = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CALayer (PromiseKit)
|
||||
|
||||
- (AnyPromise *)promiseAnimation:(CAAnimation *)animation forKey:(NSString *)key {
|
||||
PMKCAAnimationDelegate *d = animation.delegate = [PMKCAAnimationDelegate new];
|
||||
d->animation = animation;
|
||||
[self addAnimation:animation forKey:key];
|
||||
return [[AnyPromise alloc] initWithResolver:&d->resolve];
|
||||
}
|
||||
|
||||
@end
|
1
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/PMKQuartzCore.h
vendored
Normal file
1
Carthage/Checkouts/PromiseKit/Extensions/QuartzCore/Sources/PMKQuartzCore.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#import "CALayer+AnyPromise.h"
|
Reference in New Issue
Block a user