PNG has not been display on Image class for Swift UI

Hello

I've been trying to draw transparent PNG file.

Following typical way, I wrote down as below

VStack {
Image("*file name*")
}

Then, PNG image's stroke has been drawn.(so, I can recognize the shape of the image and size). However, kind of body area of PNG image has not been drawn.(Semi-transparent gray has been drawn for this area)
 
I want to solve the situation. Problem is file format? or Program?

Have any of you ever had issues like that?
Or maybe you just know what’s going on and how to fix it?


Answered by Claude31 in 642031022
Is the image in xcAssets (It should).

If so, how have you defined the image "Render as" property ?
  • Select the image in xcAssets.

  • Open Attributes inspector.

  • Try to set as "original image" ;

  • if does not work, try "Template"

Can you share the image file you cannot show in Image?
Accepted Answer
Is the image in xcAssets (It should).

If so, how have you defined the image "Render as" property ?
  • Select the image in xcAssets.

  • Open Attributes inspector.

  • Try to set as "original image" ;

  • if does not work, try "Template"

@Claude31
I've tried to set as "Original image" on Attributes inspector of xcAssets.
Then, problem has been solved. The picture of the body area of png image has been shown.

Thank you so much! :-)

@OOPer
Thank you for your reply :-)

Thanks for feedback.

Documentation on that point is pretty limited (in fact inexistant).
That could be worth a bug report against documentation.
PNG has not been display on Image class for Swift UI
 
 
Q