Xcode 16.0 + SwiftUI: Failed to launch app "MyApp.app" in reasonable time

I am working on transitioning an existing UIKit based app to SwiftUI. After adding a first SwiftUI file to the project preview fails with:

Failed to launch app "MyApp.app" in reasonable time

The View code is the default templates, thus definitly not too complex:

import SwiftUI

struct OverviewPageView: View {
    var body: some View {
        Text("Hello, World!")
    }
}

#Preview {
    OverviewPageView()
}

Things I have tried:

  • Cleaning and rebuilding.
  • Changing the target device.
  • Using xcrun simctl shutdown all followed by scrub simctl erase all
  • Clearing the contents of my ~/Library/Developer/Xcode/UserData/Previews folder.
  • Clearing the contents of my ~/Library/Developer/Xcode/DerivedDatas folder.
  • Using xcrun simctl --set previews delete all
  • Restarting macOS and Xcode

The problem seems tpbe related to my project. When creating a fresh new project using "Storyboard" as interface and adding a SwiftUI file, the preview works fine. However, this does not help when working on my existing project...

I generated a preview diagnostics report.

I am using Xcode 16.0 on macOS 15.0

Hi,

Sorry to hear you are having problems getting previews working. This error can often indicate a crash in your application when it launches, or a problem with the simulator. If you look into the folder ~/Library/Logs/DiagnosticReports, do you see any crash reports for your app?

If not, the best next step will be to file a feedback with diagnostics so we can take a look.

We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

If you are having issues with Xcode, macOS, catalyst or on-device iOS previews then download and install the logging profile for your device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the radar as well as the diagnostics using the instructions below.

Then when you reproduce the problem in Xcode:

  1. Either (a) an error banner will appear, click the "Diagnostics" button in that banner; or (b) if you're not seeing an error but you still want to provide diagnostics you can get the same diagnostics window by going under the Editor menu in the menu bar, then selecting the Canvas submenu, then selecting "Diagnostics".
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
  4. Generate the sysdiagnose(s) and attach those too

I have submitted the feedback including the diagnostics report as advised: FB15429176

Editor > Canvas > Use Legacy Previews Execution Works for me. Thanks!

Xcode 16.0 + SwiftUI: Failed to launch app "MyApp.app" in reasonable time
 
 
Q