Saffron is a framework that gives a helping hand to download images and manage caches.
- Thread safe and generic cache mechanism.
- Convenient extensions for UIImageView that do download and cache things for you.
- Built in loading animator which can be configured.
- Options to process image (corner radius, scale and GaussianBlur).
- GIF image support.
- Easy to use.
imageView.sf_setImage(#some image url string#)
That's all!
Process image
imageView.sf_setImage(url, options: [.ScaleToFill(size), .CornerRadius(8), .GaussianBlur(10))
// image would be processed in order and assign the result image to imageView.
let stringCache = Cache<String, String>()
// write to cache
stringCache[key] = "value"
// fetch from cache
let cachedString = stringCache[key]
func whereImageViewShouldBeInitialized() {
let loader = DefaultAnimator(revealStyle: .Circle, reportProgress: false)
imageView.sf_setAnimationLoader(loader)
}
func whereImageViewShouldBeInitialized() {
let loader = DefaultAnimator(revealStyle: .Fade, reportProgress: false)
imageView.sf_setAnimationLoader(loader)
}
func whereImageViewShouldBeInitialized() {
let loader = DefaultAnimator(revealStyle: .Fade, reportProgress: true)
imageView.sf_setAnimationLoader(loader)
}
- iOS 8.0+
- Xcode 7.3+
Put github "CaptainTeemo/Saffron"
in your cartfile and run carthage update
from terminal, then drag built framework to you project.