Using SwiftData with a local and CloudKit backed configuration at the same time

I'm trying to set up an application using SwiftData to have a number of models backed by a local datastore that's not synced to CloudKit, and another set of models that is. I was able to achieve this previously with Core Data using multiple NSPersistentStoreDescription instances.

The set up code looks something like:

    do {
      let fullSchema = Schema([
        UnsyncedModel.self,
        SyncedModel.self,
      ])

      let localSchema = Schema([UnsyncedModel.self])
      let localConfig = ModelConfiguration(schema: localSchema, cloudKitDatabase: .none)

      let remoteSchema = Schema([SyncedModel.self])
      let remoteConfig = ModelConfiguration(schema: remoteSchema, cloudKitDatabase: .automatic)

      container = try ModelContainer(for: fullSchema, configurations: localConfig, remoteConfig)
    } catch {
      fatalError("Failed to configure SwiftData container.")
    }

However, it doesn't seem to work as expected. If I remove the synced/remote schema and configuration then everything works fine, but the moment I add in the remote schema and configuration I get various different application crashes. Some examples below:

A Core Data error occurred." UserInfo={Reason=Entity named:... not found for relationship named:...,
Fatal error: Failed to identify a store that can hold instances of SwiftData._KKMDBackingData<...>

Has anyone ever been able to get a similar setup to work using SwiftData?

Using SwiftData with a local and CloudKit backed configuration at the same time
 
 
Q