AlamofireObjectMapper
AlamofireObjectMapper copied to clipboard
How can I handle case where i Need to handle same value with diffrent keys?
class User:Mappable { dynamic var name:Srtring? dynamic var players:List<Players>()
func mapping(map: Map) { name <- map["name"] players <- (map["players"] ,listTransform<Player>()) // this key can be friends in other scenarion but need to map same Player object . } }
How can I acheive this .?
You could do something like:
if let players = map.JSON["players"] { // Set values } else if let friends = map.JSON["friends"] { // Set values }