I am using AFNetworking in my iOS app and for all the GET requests it makes, I build the url from a base URL and than add parameters using NSDictionary Key-Value pairs.
private func tellServerSomething(_ d: String, _ s: String) {
var c = URLComponents(string: "https://you.com/info")
c?.queryItems = [
URLQueryItem(name: "description", value: d),
URLQueryItem(name: "summary", value: s)
]
guard let u = c?.url else { return print("url fail") }
do {
let r = try String(contentsOf: u)
print("Server response \(r)")
}
catch { return print("comms fail") }
}
Percent-encoding and everything else is handled.