How do I properly use Codable, CoreData and NSSet relationships?

前端 未结 1 1255
暖寄归人
暖寄归人 2021-01-22 09:35

I\'m following this tutorial to implement CoreData with Codable. Everything seems to be going great however I cannot figure out how to encode my list of photo objec

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 10:16

    Declare photos as a swift native type

    @NSManaged var photos: Set
    

    In decoder

    photos = try values.decode(Set.self, forKey: .photos)
    

    0 讨论(0)
提交回复
热议问题