SDWebImageSwiftUI icon indicating copy to clipboard operation
SDWebImageSwiftUI copied to clipboard

WebImage not working with SVG

Open mr-kew opened this issue 11 months ago • 1 comments

I did try to use the WebImage on SVG that found in example and it's displaying nothing.

Code:

let url = URL(string: "https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/wikimedia.svg")
WebImage(url: url) { image in
    image.resizable()
} placeholder: {
    Text("No image")
}
.indicator(.activity)
.scaledToFit()
.frame(size: .square(side: 300))

Log:

extractOptions:211: *** ERROR: unknown hint identifier 'kCGImageSourceTypeIdentifierHint:public.svg-image' -- ignoring...
createImageAtIndex:1964: *** ERROR: createImageAtIndex 1 could not find plugin for image source [273 bytes] 3C 73 76 67 20 78 6D 6C... '<svg xml'
createImageAtIndex:2093: *** ERROR: createImageAtIndex[0] - 'n/a ' - failed to create image [-62]
CGImageSourceCreateImageAtIndex:5100: *** ERROR: CGImageSourceCreateImageAtIndex[0] - 'n/a ' - failed to create image [-62]

mr-kew avatar Jan 28 '25 14:01 mr-kew

You hit the Apple ImageIO coder. Which is wrong. Check https://github.com/SDWebImage/SDWebImageSVGCoder readme again.

dreampiggy avatar Feb 02 '25 10:02 dreampiggy