-
Re: Loading SVG smbol in swiftui image
kevinfromleverkusen Jul 5, 2019 3:05 AM (in response to Kabe)SVG is simply not supported. You need to rasterize (PNG etc) or convert (PDF) it.
-
Re: Loading SVG smbol in swiftui image
iQQator@RBC Jul 5, 2019 4:11 PM (in response to kevinfromleverkusen)PDF also won't load in Image
-
Re: Loading SVG smbol in swiftui image
Kabe Jul 8, 2019 11:43 AM (in response to kevinfromleverkusen)Well, if SVG is not supported – and I know that traditionally this hasn't been the case –, then why does the SF Symbols app has this export for „Prepare Custom Symbol for XCode“?
See https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/ for further details of the proposed process.
-
Re: Loading SVG smbol in swiftui image
JimmyCricket Jul 9, 2019 10:57 AM (in response to Kabe)It seems that SVG support is new but was half heartedly implemented making it feel as though support is lacking. By my various messings with it so far, raw svg's and custom symbols from SF Symbols are both wonky.
-
-
-
Re: Loading SVG smbol in swiftui image
rickyfromdenver Aug 21, 2019 4:51 PM (in response to Kabe)I also ran into this today. I REALLY hope its just a bug, otherwise there's really no point in using custom symbols in SwiftUI.
I did find a work around, but it doesn't really suit my needs - dynamic resizing and tint coloring don't work as they ought to. Here's the workaround:
var iconName: String var dynamicImage: UIImage { let configuration = UIImage.SymbolConfiguration(textStyle: .body, scale: .large) let image = UIImage(named: iconName) ?? UIImage() return image.withConfiguration(configuration) } var body: some View { Image(uiImage: dynamicImage) } )