Created
June 6, 2020 08:03
-
-
Save mukyasa/f309f737d143da40ee7cd29fe840e806 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class LottieAnimationCache: AnimationCacheProvider { | |
fileprivate var cacheAnimation: Animation! | |
public init() {} | |
/// Clears the Cache. | |
public func clearCache() { | |
} | |
/// The global shared Cache. | |
public static let sharedCache = LottieAnimationCache() | |
public func animation(forKey: String) -> Animation? { | |
if cacheAnimation != nil { | |
return cacheAnimation | |
} | |
guard let animation = CodableStorageHelper<Animation>.getValueFor(key: forKey) else { | |
return nil | |
} | |
cacheAnimation = animation | |
return cacheAnimation | |
} | |
public func setAnimation(_ animation: Animation, forKey: String) { | |
CodableStorageHelper<Animation>.setValue(animation, | |
key: forKey) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment