u/klarkzenin r/swift • Recommends
On “Using UrlSession with parameters?”
…= "7465be2382c82a728bf78ed04fb3e1d0"
let url = URL(string: http://api.openweathermap.org/data/2.5/weather/?q=\(query)&appid=\(apiKey))
You should also remove `allHTTPHeaderFields` and its array as it is unnecessary. I tested using Postman and it returned JSON.
Also, with Swifts new Decodable protocol it's far easier to work with JSON. This link to this video helped me understand how to set up a dataTask that parses JSON.…