In XCode Beta 7 I am getting a new error: Cannot convert value of type 'ModelConfiguration' to expected argument type 'any PersistentModel.Type'
struct AppleClosetApp: App {
let config = ModelConfiguration(url: AppGroup.facts.containerURL ?? URL(fileURLWithPath: ""))
var body: some Scene {
WindowGroup {
ClosetNavigationView()
.modelContainer(try! ModelContainer(for: Closet.self,
config))
}
}
}
Anyone else saving to a custom swift data URL getting this emergent issue?
The signatures for the ModelContainer convenience initializers have changed to take the configuration as a named parameter. This should do the trick:
struct AppleClosetApp: App {
let config = ModelConfiguration(url: AppGroup.facts.containerURL ?? URL(fileURLWithPath: ""))
var body: some Scene {
WindowGroup {
ClosetNavigationView()
.modelContainer(try! ModelContainer(for: Closet.self,
configurations: config))
}
}
}