Swift GET request with parameters. When building a GET request, there is no body to the request, but rather everything goes on the URL. To build a URL (and properly percent escaping it), you can also use URLComponents.
1 2 3 4 5 |
var url = URLComponents(string: "https://www.google.com/search/")! url.queryItems = [ URLQueryItem(name: "q", value: "War & Peace") ] |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.