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

前端 未结 1 1148
暖寄归人
暖寄归人 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<Photo>
    

    In decoder

    photos = try values.decode(Set<Photo>.self, forKey: .photos)
    
    0 讨论(0)
提交回复
热议问题