SDWebImage / SDWebImageSVGCoder

A SVG coder plugin for SDWebImage, using Apple's built-in framework
MIT License
103 stars 34 forks source link

SwiftUI SVG -> WebImage Inconsistencies #38

Open mackhowell opened 2 years ago

mackhowell commented 2 years ago

This coder was super easy to add which was awesome right off the bat, but I'm seeing some issues with most SVG's I try drawing.

Would love some help if I'm doing something wrong. Examples below.

SwiftUI code used:

WebImage(url: URL(string: "https://storage.opensea.io/files/30cdec8b3f25da72e82bba1c36c23fa6.svg")!, context: [.imageThumbnailPixelSize: CGSize.zero])
    .resizable()
    .scaledToFit()
    .border(Color.gray)

Example 1:

SVG url: https://storage.opensea.io/files/30cdec8b3f25da72e82bba1c36c23fa6.svg

Output:

CleanShot 2022-02-09 at 08 11 55@2x

Issue: This SVG is just a colored square, so ideally it should fill the entire frame of the WebImage. Instead it's only occupying a small portion.

Example 2:

SVG url: https://storage.opensea.io/files/0a551bef6cba9c8af017420aafe7657a.svg

Output:

CleanShot 2022-02-09 at 08 16 53@2x

Issue: The text inside the SVG is not centered.

Can provide more examples if needed. Also happy to create a pull request to the coder if I could get a little guidance on the nature of the issues(s)

Thank you!