Home > OS >  How to show a URL image on frontend in SwiftUI
How to show a URL image on frontend in SwiftUI

Time:10-27

I'm storing my images manually in Firebase with an HTTPS link, but how would I show it on the frontend as an image instead of just the link in String format?

Here's my code so far:

Vstack{
 Image(skinproduct.image)
       .resizable()
       .aspectRatio(contentMode: .fit)
       .frame(width: 120, height: 120)
}

CodePudding user response:

You need to import a package by going to file -> add Packages : and the search for the package called SDWebImageSwiftUI.

You will then need to import the package on the top of your view as:

import SDWebImageSwiftUI

and to call it on the frontend:

WebImage(url: URL(string: skinproduct.image))
  • Related