ios - Generic Parameter cannot be inferred in Closure -
right trying create network layer class on alamofire
, alamofireobjectmapper
library. have created 1 method request here following code
func getrequest<t: basemappable>(_ url : string, success: @escaping (dataresponse<t>) -> void, failure: @escaping (error) -> void) -> void { self.request(url, method: .get).responseobject{ (response : dataresponse<t>) in success(response dataresponse<t>) } }
i have imported following library in project
import alamofire import alamofireobjectmapper import objectmapper
here error getting while trying method in viewcontroller
thanks in advance support
try changing (response: dataresponse <country>)
in block argument.
this because generic function doesn't know type use generic parameter , type checker can't infer it. stating type explicitly.
Comments
Post a Comment