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 byscrub 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