SwiftUI SVG gradient support in Xcode 12

I've added an SVG image to the asset catalogue of a SwiftUI project in Xcode 12 beta 3, and set 'Render as' to 'original'.

The gradient background in the SVG image gets rendered in different ways depending on the platform.
  • In the Xcode's asset catalogue's preview, the gradient is rendered as a solid color

  • In the MacOS version of the SwiftUI app, the gradient appears as a solid color as well

  • In the iOS version of the SwiftUI app, the gradient appears as a solid white area.

I understand Xcode is in beta and not everything feature is working and I was wondering if this is an issue (assuming it is a bug) that will be fixed in an upcoming beta version, or if I should switch to a different file format for my images.
  • I'm still seeing this issue in Xcode 12.5.1

    I wonder if it was fixed in Xcode 13 beta or not, but I can install it on my computer.

Add a Comment

Replies

Have you found a solution to this yet? Gradient and opacity are not rendered correctly. I'm using Image(name: "svgAsset") and it's rendered, but scaling the image pixelates it, gradient is rendered as solid color, and opacity is rendered as full black.