SFRemoteImage is a lightweight thread-safe image downloading and caching library built on the top of NSOperationQueue.
It supports currently iOS 9+.
SFRemoteImage is available through cocoapods and swift package manager.
- Add to podfile
pod 'SFRemoteImage', :git => 'https://github.com/SaifullahIlyas/SFRemoteImage.git'
- Install by running
pod install
SFRemoteImage available through imageview instance method as well as through facade method of SFRemoteImage by importing
import SFRemoteImage
image(fromURL: , andPlaceHolderImage: , shouldShowProgress:)
fromURL(required)
is URL String of remote image available on Server.andPlaceHolderImage(optional)
is the placeholder Image to show on imageView while downloading or after downloading if no image is found in the provided URL.shouldShowProgress(optional)
can either be a bool value to show default activity indicator or a custom view to show as progress on imageview while downloading.
self.imageView.image(fromURL: url, andPlaceHolderImage: placeHolder,shouldShowProgress : true)
Or By Passing Custom Loader
var loaderToShow : UIActivityIndicatorView {
let activty = UIActivityIndicatorView()
activty.startAnimating()
activty.color = .cyan
return activty
}
self.imageView.image(fromURL: url, andPlaceHolderImage: placeHolder, shouldShowProgress:loaderToShow)
image(fromURL : String, completion : onImageResult)
fromURL(required)
url to download Image .completion(required)
is colosure that accept UIImage,Data
image(fromURL url : String,intoImageView imageView : UIImageView?,andPlaceHolderImage placeholderImage : UIImage?)
fromURL(required)
url to downloadImageintoImageView(optional)
imageview in which you want to display the image after download.placeholderImage(optional)
is the placeholder Image to show on imageView while downloading or after downloading if no image is found in the provided URL.
SFRemoteImage.image(fromURL: URLString, intoImageView: imageView,andPlaceHolderImage: placeHolder))
or by
SFRemoteImage.image(fromURL: url){image, data in
}
- Fork it
- Create your feature/bugfix branch (git checkout -b feature-fname || git checkout -b bugfix-bname )
- Commit your changes (git commit -a 'message explaining the task . your addition overview')
- Push to the branch (git push origin your-branch-name)
- Open pull request by explaining what was the issue, what was your finding. what action was taken by you and finally how did it improves the performance.