swift - how to fix this dictionaryValue -


alamofire.request(.get,  "https://maps.googleapis.com/maps/api/place/details/json", parameters:["placeid": x , "key":"aizasyaasdaxw-j8diggjy58_hdrasdaqqa"])                 .responsejson { (responsedata) -> void in                     //debugprint(responsedata)                       switch responsedata.result{                      case .success(let req):                         let response = json(req)                          let items = response["result"]["geometry"]["location"].dictionaryvalue                          let lat: double = double(items["lat"]!.doublevalue)                         let lng: double = double(items["lng"]!.doublevalue)                          print(lat,lng)                            item in items{                           self.mapresult.append(mapmodel(json:item)) // *this error cannot convert value of type '(string:json)' expected argument type 'json'                          }                      case .failure(let err):                       print("request failed error: \(err)")                     }             } 

your items dictionary, have iterate this:

for (key, value) in items { } 

so can pass value function instead of passing dictionary element it. error seeing telling you pass dictionary argument (string:json) while expects json argument.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -