ARView doesn't fill screen when using SwiftUI (from Xcode AR Template)

I created a project in Xcode 12.0.1 (12A7300) using the Augmented Reality template and SwiftUI.

For some reason, the arView doesn't fill the complete screen, even though I've added .edgesIgnoringSafeArea(.all)

When using Storyboard, the template project does fill the complete screen.

After digging deeper, I noticed that the camera app (1x lens on iPhone 11 Pro Max), shows the same field of view as the SwiftUI AR app. So I believe that the arView is being fit to the camera feed image, instead of filling the screen.

Does anyone know how to let arView fill the screen when using SwiftUI as the interface framework?

Replies

Hello,

You are probably having the same issue that was discussed in this thread: https://developer.apple.com/forums/thread/665031
Unfortunately it appears that the Augmented Reality Template is slightly broken and is still currently an issue as of Xcode version 12.4.

The issue with the template is that it is missing a LaunchScreen.storyboard file and this causes the app to launch into a compatibility mode which results in the letterbox view you are seeing.

I have logged this as a feedback item and hopefully it will be resolved in a future release of Xcode but in the meantime there are a couple of options to resolve this:
Option 1: Create a LaunchScreen.storyboard file and ensure the "Launch Screen Image" is set to the LaunchScreen.storyboard in General -> App Icons and Launch Images.

Option 2: Create a new project using the default "App" template and then just copy your code across.