I've been diverted on another project for a bit, so I'm coming back to this after a bit: This answer put me on the right track, I think, but there's something I'm still missing:
If I have a DocumentGroup that drives the main document interface, and I want to use WindowGroup to display auxiliary information about a particular model, those two root-level objects need to share the same SwiftData ModelContext, no?
But DocumentGroup auto-injects the ModelContext through the (editing: .encounterList, migrationPlan: EncounterListMigrationPlan.self) initializer.
How can I then share that context with the WindowGroup? I can get the binding to the id just fine, but I can't figure out how to load the model from that point.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: