tristanhimmelman / AlamofireObjectMapper

An Alamofire extension which converts JSON response data into swift objects using ObjectMapper
MIT License
2.66k stars 474 forks source link

Cannot convert value of type DataResponse<Token1> #210

Closed krishnameena closed 7 years ago

krishnameena commented 7 years ago
screen shot 2017-06-08 at 8 30 28 pm
dagi12 commented 7 years ago

Maybe you forget to add Mappable protocol on Token1?

krishnameena commented 7 years ago

I have added that , this one

public protocol Mappable {
    init?(_ map: Map)
    mutating func mapping(map: Map)
}

class Token1: Mappable {

    var accessToken: String?

    required init?(_ map: Map) {

    }

    // Mappable
    func mapping(map: Map) {
        accessToken    <- map["access_token"]
    }

}
dagi12 commented 7 years ago

Do not create your own protocol. "import ObjectMapper" in your model

krishnameena commented 7 years ago

Thanks you saved my day 👍