How to insert new data to entity in Swift3?

前端 未结 4 1523
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-20 14:56

In swift previously, I was able to use a code like this to add new data to my \"TestEntity\" in my data model.

NSManagedObject was created for my \"TestEnti

4条回答
  •  囚心锁ツ
    2021-02-20 15:23

    If there is a NSManagedObject subclass TestEntity the new syntax is

    let entity = TestEntity(context: context)
    entity.testAttribute="test value"
    

提交回复
热议问题