Skip to content

SwiftUI SVG -> WebImage Inconsistencies #38

@mackhowell

Description

@mackhowell

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions