3 Replies
      Latest reply on May 12, 2020 1:04 PM by KMT
      nokey4 Level 1 Level 1 (0 points)

        Hi, i'm working on an App where the original developer inadvertently created a Core Data stack with two store files. Instead of setting persistentStoreDescriptions to a single PersistentStoreDescription, one was appended to persistentStoreDescriptions:

         

        let persistentContainer = NSPersistentContainer(name: "AppModel")
        
        let storeURL: URL // URL pointing to a file under "Documents" folder
        let persistentStoreDescription = NSPersistentStoreDescription(url: storeURL)
        
        persistentContainer.persistentStoreDescriptions.append(persistentStoreDescription)

         

        The above ends up creating two store files, one under "Library/Application Support" and a second one under the "Documents" folder.

         

        Is there a way i can combine the two store files into one?