Skip to content

Commit

Permalink
Use shorthands for unwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 21, 2023
1 parent 390dda1 commit 3a47ef0
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions WordPress/Classes/ViewRelated/Media/AnimatedImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,25 @@ final class AnimatedImageCache {
// MARK: Instance methods

func cacheData(data: Data, url: URL?) {
guard let url = url else {
return
}
guard let url else { return }
let key = url.absoluteString + Constants.keyDataSuffix
MemoryCache.shared.setData(data, forKey: key)
}

func cachedData(url: URL?) -> Data? {
guard let url = url else {
return nil
}
guard let url else { return nil }
let key = url.absoluteString + Constants.keyDataSuffix
return MemoryCache.shared.geData(forKey: key)
}

func cacheStaticImage(url: URL?, image: UIImage?) {
guard let url = url, let image = image else {
return
}
guard let url, let image else { return }
let key = url.absoluteString + Constants.keyStaticImageSuffix
MemoryCache.shared.setImage(image, forKey: key)
}

func cachedStaticImage(url: URL?) -> UIImage? {
guard let url = url else {
return nil
}
guard let url else { return nil }
let key = url.absoluteString + Constants.keyStaticImageSuffix
return MemoryCache.shared.getImage(forKey: key)
}
Expand Down

0 comments on commit 3a47ef0

Please sign in to comment.