Reposting as I messed up with the type of encoding before... I need to send an array to the server with Alamofire using URLEncoding. However, it needs to be encoded in some way for Alamofire to send it properly. This is my code:
let parameters: [String : Any] = [
"names" : ["bob", "fred"]
]
Alamofire.request(urlString, method: .post, parameters: parameters, encoding: URLEncoding.default)
.responseJSON { response in
// etc
}
However the parameters never get encoded and just get sent as nil. How can I encode it?