Skip to content

Commit

Permalink
Fix image cache scope
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Sep 11, 2023
1 parent fb01f37 commit 824de12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Release notes


## 3.8.1

### ✨ New features

* `ImageCache.shared` has been made public.



## 3.8

### ✨ New features
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftUIKit/Images/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ public class ImageCache {
public var cache = [String: ImageRepresentable]()

/// A shared cache instance.
static let shared = ImageCache()
public static let shared = ImageCache()

/// Store an image into the cache.
func cache(image: ImageRepresentable, for key: String) {
public func cache(image: ImageRepresentable, for key: String) {
cache[key] = image
}

/// Try to get an image from the cache.
func cachedImage(for key: String) -> ImageRepresentable? {
public func cachedImage(for key: String) -> ImageRepresentable? {
cache[key]
}

/// Remove the cached image for a certain key.
func clearCache(for key: String) {
public func clearCache(for key: String) {
cache[key] = nil
}
}

0 comments on commit 824de12

Please sign in to comment.