I had the same issue after the XCode beta 5 update.
My issue has three models in an array, so a slightly different solution:
import SwiftData
import SwiftUI
@main
struct SurvAIApp: App {
let modelContainer: ModelContainer
init() {
do {
modelContainer = try ModelContainer(for: [ViewModel1.self,ViewModel2.self, ViewModel3.self])
} catch {
fatalError("Could not initialize ModelContainer")
}
}
var body: some Scene {
WindowGroup {
NavigationStack {
ContentView()
}
.modelContainer(modelContainer )
}
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: