How to Load an Image URL with Swift

Load an image from url is important for the app. The reality we find apps load an image every open app or page, that is wasting our time and internet quota. This section I will present how to load an image url effectively with Swift language.

AfriwanLib is powerfull library for load an image from url to your iOS App and easy to implement. Load an image, even there is no internet connection you can see an image that have been loaded before, so it faster to display image and saving internet quota. It’s give good experience for user.

With single line of code we can load an image from url without background:

image_view.loadImage(imageUrl: "url")

Load image with background image before image fully loaded (for example with “AppIcon” image background) with this simple code:

image_view.loadImage(imageUrl: "url", backgroundImage: #imageLiteral(resourceName: "AppIcon"))

Screen capture of example class:

Full source code of project can download from my Github. Happy Coding!!

Posted on: July 4, 2019, by :
Translate »