I have an Image
which displays it’s contents using UIImage
objects that are passed in. There is now a need to display an SFSymbol in the Image
. I am testing in a separate sample if it was possible to do so using a UIImage
with systemName
which is the SFSymbol name. However, the following code doesn’t render any image.
struct ContentView: View {
var body: some View {
VStack {
Image(uiImage: UIImage(systemName: "airplane.circle.fill")!.withRenderingMode(.alwaysOriginal))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 150, height: 150)
}
.background {
Color.black.ignoresSafeArea()
}
}
}
I know I could just use the systemName initialiser for Image
with the symbol name but unfortunately it is not possible to do so due to some constraints. Is it possible to do the required? Any help is appreciated.