IOS best network image download library – SDWebImage , Swift 3/4

IOS best network image download library – SDWebImage , Swift 3/4

Sometimes network image doest not download and for that app may crash . To avoid this you can use SDWebImage library as like Picasso android library which will show a default placeholder image until file downloaded .

To implement SDWebImage –

Step 1 :

paste the pod file in podfile of your project (If you don’t create pod file . create it with ‘pod init’ command in your project directory)

 pod 'SDWebImage', '~> 4.0'

Run command

  pod install

Step 2 :

Attach your image view

let image_url = "your_image_url"

   image_view.sd_setImage(with: URL(string: image_url ), placeholderImage: UIImage(named: "AppIcon"))

Here ,

image_view is your ImageView reference . AppIcon is default placeholder .

 

Run your . Done .

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *