I'm new to ObjectMapper. I have response from the server:
{
"123123": 10,
"435555": 2,
"435333": 8,
"567567": 4
}
Keys (dynamic) are going to be IDs. Values are going to be COUNT. How can I map it with ObjectMapper?
My code isn't working because dynamic keys:
extension Item: Mappable {
private static let kId = "id"
private static let kCount = "count"
public init?(map: Map) {
self.init()
}
mutating public func mapping(map: Map) {
id <- map[Item.kId]
count <- map[Item.kCount]
}
}