I have a .svg image file I want to display in my project.
I tried using UIImageView, which works for the .png & .jpg image formats, but not for the .svg extensi
let path = Bundle.main.path(forResource: "svgNameFileHere", ofType: "svg")!
if path != "" {
let fileURL:URL = URL(fileURLWithPath: path)
let req = URLRequest(url: fileURL)
self.webView.scalesPageToFit = false
self.webView.loadRequest(req)
}
else {
//handle here if path not found
}
Third party libraries
https://github.com/exyte/Macaw
https://github.com/mchoe/SwiftSVG
UIWebView and WKWebView booster to load faster
https://github.com/bernikovich/WebViewWarmUper