Telescope
A double-cached (NSCache and local files) web image library for SwiftUI.
For API documentation, check the Wiki.
Examples
Using an image as a SwiftUI View
TImage(try? RemoteImage(stringURL: "https://picsum.photos/800/800"))
.resizable()
.scaledToFit()
.frame(width: 800, height: 1200, alignment: .center)
Editing a remote image locally
let remoteImage = RemoteImage(stringURL: "https://my.original/image")
let aCroppedVersionOfTheImage: UIImage = ...
// Let's save the edited version
remoteImage["edited-1"] = aCroppedVersionOfTheImage
// We can use this image in Apple's Image View
// ... inside a SwiftUI body ...
// The image can be set and recalled simply by using a subscript with a tag name
Image(uiImage: remoteImage["edited-1"])
Features
- Easy setup
- SwiftUI native
- Lightweight and easy to understand
- You can implement your own optimized caching system
- Can be set to try to refresh cached images from the Internet after a certain period of time
- Double cached (persistent and volatile)
- Uses a shared cached folder (across all apps) by default