SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.14k stars 219 forks source link

Insert Local Image? #203

Closed afern247 closed 1 year ago

afern247 commented 2 years ago

Hi, how can I insert a local Image? I tried the web one but doesn't work:

WebImage(url: URL(string: "exchange-alt-solid"))

It's a SVG Format

msa1422 commented 1 year ago

Hi @afern247, Did you find any workaround for this? Please share the technique that you're using to load locally stored sag images.

msa1422 commented 1 year ago

I found the workaround. You have to provide url like such

WebImage(url: URL(fileURLWithPath: yourBundle.path(forResource: "your_image", ofType: "svg") ?? ""))
    ...
dreampiggy commented 1 year ago

Just use URL with filePath, it works as designed.