Search code examples
swiftalamofire

Query string parameter with multiple values


I have this type of url https://www.ello.ie//requests/api.php?action=updateUser&query=1408998533,Mikal,name in this url you can see the query param who's value is some id, username,and filed_name.I am unable to make this type of url using alamofire. How can I set 3 values to one param Here is my code

let parameters: Parameters = ["action": "updateUser", "query":[uid, name, type]]
Alamofire.request(BASE_URL, method: .get, parameters: parameters,encoding: URLEncoding.queryString).responseJSON { response in

}

Solution

  • Try this:

    let parameters: Parameters = ["action": "updateUser",
                                   "query": "\(uid),\(name),\(type)"]
    

    Assuming all parameters uid, name, type are non-Optional.