Skip to content

iOS image download from URL & Cache

Platform Language License

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 are 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)

Download the file here

UIImageView+loadFromUrl.swift

Github

License

UIImageView+loadFromUrl is distributed under the MIT license .


Let's grow together 🌱

Cheers 🍻