How to add Persistent History Tracking in already existing NSPersistentContainer

As I said in the title I have a core data container created in a custom class static var context: NSManagedObjectContext { let context = persistentContainer.viewContext context.automaticallyMergesChangesFromParent = true return context } // MARK: - Core Data stack static var persistentContainer: NSPersistentCloudKitContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = PersistentContainer(name: "App") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { print("Unresolved error \(error), \(error.userInfo)") } }) let description = container.persistentStoreDescriptions.first description?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) container.persistentStoreDescriptions = [description!] return container }() // MARK: - Core Data Saving support static func saveContext () { let context = PersistanceService.persistentContainer.viewContext if context.hasChanges { do { try context.save() } catch { // Replace this implementation with code to handle the error appropriately. let nserror = error as NSError print("Unresolved error \(nserror), \(nserror.userInfo)") } } } And I’ve included the NSPersistentHistoryTrackingKey but the debug prints this error when saving : File is in Read Only mode due to Persistent History being detected but NSPersistentHistoryTrackingKey was not included.