Post

Replies

Boosts

Views

Activity

Swift Version?
I am running Xcode 10.3 on a MBP from 2015. Does this limit the version of Swift I can write with? How can I tell which version of Swift I am using? I am getting an error: Value of type URL has no member 'withQueries' and I think it is because the code is incompatible with the version of Swift I am using? let baseURL = URL(string: "https://api.nasa.gov/planetary/apod")! let query: [String: String] = [ "api_key": "DEMO_KEY", "date": "2011-07-13"] let url = baseURL.withQueries(query)! let task = URLSession.shared.dataTask(with: url) { (data, response, error) in     if let data = data, let string = String(data: data, encoding: .utf8) { print(string) } PlaygroundPage.current.finishExecution() } task.resume()
2
0
752
Dec ’21
Swift Version?
I am running Xcode 10.3 on a MBP from 2015. Does this limit the version of Swift I can write with? How can I tell which version of Swift I am using? I am getting an error: Value of type URL has no member 'withQueries' and I think it is because the code is incompatible with the version of Swift I am using? let baseURL = URL(string: "https://api.nasa.gov/planetary/apod")! let query: [String: String] = [ "api_key": "DEMO_KEY", "date": "2011-07-13"] let url = baseURL.withQueries(query)! let task = URLSession.shared.dataTask(with: url) { (data, response, error) in     if let data = data, let string = String(data: data, encoding: .utf8) { print(string) } PlaygroundPage.current.finishExecution() } task.resume()
Replies
2
Boosts
0
Views
752
Activity
Dec ’21