0

I'm using SwiftUI and Xcode 12.2 (iOS 14) for a project and building a launch screen using Interface Builder. It works fine, but whenever the launch screen includes a reference to any image file (for the contents of an Image View), the launch screen no longer works at all—instead a black screen appears. Without any images, the launch screen appears fine.

I see that this problem has been reported on and off in recent years, and the fixes include:

  1. Move the images out of the asset catalog and/or
  2. Delete derived data, delete app from simulator/device, clean build folder.

I've tried both of these with no success. Neither in Simulator nor on physical device. Any thoughts?

Anton
  • 2,512
  • 2
  • 20
  • 36

1 Answers1

-1

Have you tried to add constraint to your image like so :

Image("myBackgroundImage") .resizable() .aspectRatio(contentMode: .fit)

Maybe your image is too big to be displayed on the view

  • Thanks. But I do have constraints for the image—both position and size. (And, sadly, it is not possible to use SwiftUI yet to build launch screens; I'm working in IB.) It appears fine in the preview, just not in the Simulator. – Anton Nov 21 '20 at 21:46