Image not visible in SwiftUI project

Hello everyone,

I'm facing an issue with my SwiftUI project, and I would appreciate some help in resolving it. The problem is that one of the images in my project is not visible when I use it in my code.

Here are the details of the issue:

I have for example two images, "AIOx2.png" and "AIOx3.png", both of which are placed in the "Assets.xcassets" folder of my Xcode project. When I use "AIOx3.png" in my SwiftUI code (e.g., replacing Image("AIOx2") with Image("AIOx3")), the image is visible on the preview canvas and simulator. However, when I use "AIOx2.png" in the same way, the image is not visible on the preview canvas or the simulator. I have verified that the file "AIOx2.png" is correctly named and is in the same location as "AIOx3.png" in the "Assets.xcassets" folder. There are no error messages or warnings related to the image in the Xcode console. I have tried several troubleshooting steps, such as cleaning and build, restarting Xcode, re-downloading and re-adding the image to the project, but the issue persists.

Is there anything specific that I might be missing or any other suggestions for troubleshooting this problem? I would be grateful for any guidance or insights into resolving this issue.

Thank you in advance for your help!

Best regards, Adam

Replies

I would check the colorspace, size, etc.

Maybe export a jpg version and see if the jpg works, just to narrow it down.

Is the second letter in the file name a lowercase "L" or an uppercase "i"?

  • Thank you very much for your answer! I already tried to renamed it, change to jpeg and even pdf, I change also the size of the pictures, nothing works 😬

Add a Comment