From the course: iOS Network Development Using URLSession and Alamofire

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

URL parameter encoding for a GET

URL parameter encoding for a GET

- [Instructor] So we looked at doing a regular GET request using just a URL string with Alamofire but many times we have to be able to send parameters along with the GET request. So Alamofire.request allows us to send additional parameters. Typically the GET parameters are sent to the Alamofire.request in the form of a dictionary where the key is a string and the value is Any. We'll also send in a ParameterEncoding enum value and that's a protocol, and we'll look at that and other options as we go. The typical URLEncoding enum values for a GET request would be none, default, and queryString, and we'll see that actually in the uses of them, they all amount to the same thing. So in Xcode, we'll open up our project from the previous video, where we're doing a GET request that just takes a URL, and we want to be able to add parameters to that call. So in our function, fetchURL on line 29, we'll add a second parameter called param and that takes a dictionary of String:Any. So of course in…

Contents