What's the right way to use CoreData in an AppIntent?

270 Views Asked by At

I have an AppIntent (introduced in iOS 16.0) that utilizes my Core Data store. If I enable CoreData's concurrency debugging (add this argument to scheme -com.apple.CoreData.ConcurrencyDebug 1), I get errors while my app is running.

I've begun using background contexts from my container in conjunction with context.performAndWait and am able to avoid the concurrency error.

Is this the right way to use CoreData within an AppIntent, or is there a different pattern I should be leveraging?

0

There are 0 best solutions below