Created
November 3, 2019 18:14
-
-
Save sgl0v/59e74c2616fa11ca02ff252e01d68b2b 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
| // Declares in-memory image cache | |
| protocol ImageCacheType: class { | |
| // Returns the image associated with a given url | |
| func image(for url: URL) -> UIImage? | |
| // Inserts the image of the specified url in the cache | |
| func insertImage(_ image: UIImage?, for url: URL) | |
| // Removes the image of the specified url in the cache | |
| func removeImage(for url: URL) | |
| // Removes all images from the cache | |
| func removeAllImages() | |
| // Accesses the value associated with the given key for reading and writing | |
| subscript(_ url: URL) -> UIImage? { get set } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment