I have some SVG files that are not loading up in iOS. (Swift 5, Xcode 13.2.1) Here is the one of those SVG: https://svgshare.com/i/dWy.svg
There are below alternatives that I've tried:
- I'm using
SDWebImageSVGKitPlugin
library to load up the SVG from the server. The error that I get from the library is:
"Downloaded image decode failed"
UserInfo={
NSLocalizedDescription=Downloaded image decode failed
}
- I tried below code to directly download image from server in data format and convert it into UIImage:
if let url = URL(string: "https://svgshare.com/i/dWy.svg") {
do {
let imageData = try Data(contentsOf: url)
if let image = UIImage(data: imageData) {
print(image)
}
} catch {
print("Error downloading image: \(error)")
}
}
- I tried
SwiftSVG
library but the SVG image is not loading up and also there is no error in the console too.
Observation:
One strange thing is happening with this is that if I download the SVG from server, add it to the project in Assets.xcassets
folder than that particular SVG is being loaded properly but when received from server it is not being loaded.
Any help will be appreciated.
Also if any additional information is required than please let me know.
Thanks in advance!