Xcode build crashes on: No such module '_SwiftData_SwiftUI'

Building with below imports returns an error. What could I do to mitigate this? I did clean the build cache and delete the derived data folder.

import SwiftData
import SwiftUI

The error:

Command SwiftCompile failed with a nonzero exit code
/Users/thomas/Documents/Projects/SwiftUI/workouts/Workouts/Workouts/Views/Workout/WorkoutView.swift:9:8 No such module '_SwiftData_SwiftUI'

This feedback has also been submitted under: FB14182548

I had the same problem (& tried the same cleaning/deleting steps) when I first installed Xcode 16 beta 2. It only occurred in a project that I had created using Xcode 16 beta 1. I never could figure out what was causing it. I ended up just re-creating the project fresh in beta 2 and that worked. Luckily it wasn't a very big project. I copied over most of the code files as-is from the crashing project, so I suspect Xcode was just "confused" about something in the project file.

Im running into the same issue - it started happened as I struggled to configure SwiftTesting (it kept hanging on indexing). I had delete my build folder, and based on other suggestions my DerivedData folder.

Very frustrating to have a project completely break due to trying to get SwiftTesting to work.

EDIT: Turning off explicitly build modules in build settings seems to have cured the issue - although my tests still hang on 'indexing'

Xcode build crashes on: No such module '_SwiftData_SwiftUI'
 
 
Q