Relationship1 Relationship을 가지는 CoreData를 json으로 변환하기 우선 다음과 같은 Entity 2개가 있고, 각 relationship을 갖고 있다라고 가정하자. 그래서 Human에 대한 데이터를 json으로 저장하고자 한다. 각 NSManagedObject를 extension하여 encdoable을 채택해준다. extension Human: Encodable{ enum CodingKeys: String, CodingKey { case name, age } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(name, forKey: .name) try container.encode(age,.. 2021. 9. 7. 이전 1 다음