Image From URL — SwiftUI

Downloading Image from URL is easy in swift and also third party SDKs available for doing this. Also for SwiftUI, it is easy to do this. Here i will explain various ways to get image from URL.

Before iOS 15

No async library provided for SwiftUI before the release of iOS 15 for downloading image from URL. Here i will give an extension, which is least appreciable to use this for more data if come from API.

How to use this

Using SDKs

But the above practice won’t work fine with professional work. So for this we can use SDKs is a best practice. Most known familiar SDK which supports SwiftUI i know is SDWebImage. Here I share a piece of code using SDWebimage SDK.

After iOS 15

Recent release of iOS 15, Apple provide a library to download image asynchronously from URL. Here is the piece of code to do this.

Happy Coding!🌎

Passionate iOS developer chasing my dreams toward success