From https://stackoverflow.com/a/65525585/3390

container = NSPersistentContainer(name: "Model")
container.persistentStoreDescriptions.first!.setOption(FileProtectionType.complete as NSObject,
                                                       forKey: NSPersistentStoreFileProtectionKey)
container.loadPersistentStores(completionHandler: { (storeDescription, error) in