Ligtly and extensional library for downloading and caching images from the web, likes Nuke.
More features, read Demo
//loading iamge from web
self.imageView.ys.loadImage(with: URL(string: "your webimage url")!)
or add a placeholder image like this
self.imageView.ys.loadImage(with: URL(string: "your webimage url")!, placeholder: UIImage(named:"rabbit_1"))
Downloading web image for any objects becomes easy with Rabbit. For example make UIButton has this capability.
extension UIButton : YsSwift.Target {
public func handle(response: Result<Image, YsSwift.RequestError>, isFromMemoryCache: Bool) {
guard let image = response.value else { return }
self.setImage(image, for: .normal)
}
}
then use API from Rabbit to dowload image for UIButton
Rabbit.loadImage(with: URL(string: "your webimage url")!, into: self.button)