-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LOTCacheProvider allow external developer provide their own cache for Lottie.
- Loading branch information
1 parent
173e6d7
commit 2ae59bc
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// LOTCacheProvider.m | ||
// Lottie | ||
// | ||
// Created by punmy on 2017/7/8. | ||
// | ||
// | ||
|
||
#import "LOTCacheProvider.h" | ||
|
||
@implementation LOTCacheProvider | ||
|
||
static id<LOTImageCache> _imageCache; | ||
|
||
+ (id<LOTImageCache>)imageCache { | ||
return _imageCache; | ||
} | ||
|
||
+ (void)setImageCache:(id<LOTImageCache>)cache { | ||
_imageCache = cache; | ||
} | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LOTCacheProvider.h | ||
// Lottie | ||
// | ||
// Created by punmy on 2017/7/8. | ||
// | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR | ||
|
||
#import <UIKit/UIKit.h> | ||
@compatibility_alias LOTImage UIImage; | ||
|
||
@protocol LOTImageCache; | ||
|
||
#pragma mark - LOTCacheProvider | ||
|
||
@interface LOTCacheProvider : NSObject | ||
|
||
+ (id<LOTImageCache>)imageCache; | ||
+ (void)setImageCache:(id<LOTImageCache>)cache; | ||
|
||
@end | ||
|
||
#pragma mark - LOTImageCache | ||
|
||
/** | ||
This protocol represent the interface of a image cache which lottie can use. | ||
*/ | ||
@protocol LOTImageCache <NSObject> | ||
|
||
@required | ||
- (LOTImage *)imageForKey:(NSString *)key; | ||
- (void)setImage:(LOTImage *)image forKey:(NSString *)key; | ||
|
||
@end | ||
|
||
#endif |
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