To make a GET request with parameters, you can use Alamofire's request(_:method:parameters:)
method. Here's an example:
main.swift209 chars9 lines
In this example, we're making a GET request to the specified URL with the parameters dictionary in the request. The responseJSON
closure is called with the response from the server, which we're just printing to the console for debugging purposes.
Note that Alamofire automatically encodes the parameters as query parameters for GET requests. If you need to encode the parameters in a different way, you can use a custom encoding.
gistlibby LogSnag