0.7.0
What's New
New API: withContext
All @NSModelActor and @NSMainModelActor actors now gain two new methods via the NSModelActor protocol extension, enabling direct synchronous access to the underlying Core Data context from within the actor's isolation boundary.
// Inspect persistent store state in tests — context only
try await handler.withContext { context in
let items = try context.fetch(Item.fetchRequest())
#expect(items.count == 1)
}
// Also access the container for cross-context verification
try await handler.withContext { context, container in
let verificationContext = container.newBackgroundContext()
let items = try verificationContext.fetch(Item.fetchRequest())
#expect(items.count == 1)
}Both overloads require T: Sendable, preventing managed objects from accidentally escaping the actor's isolation boundary.
Internal Cleanup
• Removed the unreachable enqueue(_ job: consuming ExecutorJob) overload from NSModelObjectContextExecutor. The enqueue(UnownedJob) path covers all supported OS versions (iOS 13+).
Documentation
• Added NSModelActor Protocol API section to README covering modelContext, modelContainer, the subscript accessor, and withContext usage examples.