UIImageView-loadFromUrl
iOS UIImageView+loadFromUrl.swift class for load image from URL & Add image to cache if need.
Overview
- Manual drag & drop the class
- Swift 5.0 above
- Xcode 11 above
- Download image from URL
- Download image from URL & added to cache
- Default image option
let url:URL? = URL(string: "https://raw.githubusercontent.com/Sivabalaa/images/master/iOSTreeLogo.png")
Use the below code to get image from URL
imageView.setImage(from: url, placeholder: UIImage(named: "sample"))
or
imageView.setImage(from: url)
If you loading multiple image in UITableview
or in UICollectionView
Use the below code to get image from URL & added to cache
imageView.setImage(from: url, isCache: true)
or
imageView.setImage(from: url, placeholder: UIImage(named: "sample"), isCache: true)