As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
List type does not conform to Codable(Decodable), it is impossible to use Codable if the class has List type.
List
Codable
Decodable
How to resolve this issue?
class Libraries: Entity, Codable { @objc dynamic var name: String? @objc dynamic var location: GeoPoint? let booksList = List<Books>() override class func collectionName() -> String { return "Libraries" } //Map properties in your backend collection to the members of this entity enum CodingKeys : String, CodingKey { case name = "name" case location = "location" case booksList = "books" } // Swift.Decodable required init(from decoder: Decoder) throws { //This maps the "_id", "_kmd" and "_acl" properties try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) location = try container.decodeIfPresent(GeoPoint.self, forKey: CodingKeys.location) let booksArray = try container.decodeIfPresent([Books].self, forKey: CodingKeys.booksList) booksList.append(objectsIn: booksArray) }
This solution doesn't work for me (Ambiguous reference to member 'decodeIfPresent(_:forKey:)')
let booksArray = try container.decodeIfPresent([Books].self, forKey: CodingKeys.booksList)
booksList.append(objectsIn: booksArray)
Could u please help me?
Thanks I found mistake
Wood Wayfarer
List
type does not conform toCodable
(Decodable
), it is impossible to use Codable if the class hasList
type.How to resolve this issue?
This solution doesn't work for me (Ambiguous reference to member 'decodeIfPresent(_:forKey:)')
let booksArray = try container.decodeIfPresent([Books].self, forKey: CodingKeys.booksList)
booksList.append(objectsIn: booksArray)
Could u please help me?