Enabling core data lightweight migration in Swift 3

后端 未结 5 858
野的像风
野的像风 2021-02-04 03:01

According to the articles I have read the correct way to enable core data light weight migrations is by passing options to addPersistentStoreWithType:



        
5条回答
  •  无人及你
    2021-02-04 03:28

    With the new NSPersistentContainer there are many sensible defaults. You don't have to set the properties, which most of the answers give.

    Simply create the container and load.

    let container = NSPersistentContainer(name: dataModelName)
    container.loadPersistentStores { storeDescription, error in
        // You may verify the default storeDescription has the right default for light migration
    }
    

提交回复
热议问题