You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's not related to a problem
Describe the solution you'd like
In the Swift Codegen for URLSession the template is given a "closure" based approach. The language has moved away from 1+ years now. I would like to update the template
Additional context
Previously
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endifvarsemaphore=DispatchSemaphore(value:0)varrequest=URLRequest(url:URL(string:"https://test-websvcs.nm.org/BusAdmin/Services/WebAPI/NMEmployeeMiddleTier/NMConnectAdmin/CurrentDate")!,timeoutInterval:Double.infinity)
request.httpMethod ="GET"lettask=URLSession.shared.dataTask(with: request){ data, response, error in
guard let data = data else{print(String(describing: error))
semaphore.signal()return}print(String(data: data, encoding:.utf8)!)
semaphore.signal()}
task.resume()
semaphore.wait()
Now
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endifvarrequest=URLRequest(url:URL(string:"https://test-websvcs.nm.org/BusAdmin/Services/WebAPI/NMEmployeeMiddleTier/NMConnectAdmin/CurrentDate")!,timeoutInterval:Double.infinity)
request.httpMethod ="GET"let(data, response)=tryawaitURLSession.shared.data(from: request)
guard let data = data else{print(String(describing: error))return}print(String(data: data, encoding:.utf8)!)
The text was updated successfully, but these errors were encountered:
@idelfonsog2 thank you for suggesting this improvement. I see that async/await has been added to Swift recently. Some people would still want to use the older style due to legacy codebases. We can add a toggle to generate code using the preferred style.
Feel free to create a PR for this change if you're primarily working with Swift.
Is your feature request related to a problem? Please describe.
It's not related to a problem
Describe the solution you'd like
In the Swift Codegen for URLSession the template is given a "closure" based approach. The language has moved away from 1+ years now. I would like to update the template
Additional context
Previously
Now
The text was updated successfully, but these errors were encountered: