Post

Replies

Boosts

Views

Activity

Reply to Migrating iOS 13 app to 14: how to manage AppDelegate context code for CoreData?
You initialise the persistentContainer in the init method. struct YourApp: App {     var persistentContainer: NSPersistentContainer     init() {         let container = NSPersistentContainer(name: "YourApp")         container.loadPersistentStores(completionHandler: { (storeDescription, error) in             if let error = error as NSError? {                 fatalError("Unresolved error \(error), \(error.userInfo)")             }         })         self.persistentContainer = container     }     var body: some Scene {         WindowGroup {             ContentView()                 .environment(\.managedObjectContext, persistentContainer.viewContext)         }     } }
Jul ’20