Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift codegen needs to import FoundationNetworking to work with Swift 5.x #353

Closed
webholik opened this issue Oct 9, 2020 · 0 comments · Fixed by #354
Closed

Swift codegen needs to import FoundationNetworking to work with Swift 5.x #353

webholik opened this issue Oct 9, 2020 · 0 comments · Fixed by #354
Labels
bug Something isn't working

Comments

@webholik
Copy link
Collaborator

webholik commented Oct 9, 2020

Starting with Swift 5.1, networking related functionality has been moved to FoundationNetworking. It needs to be imported for the codegen to work.

To Reproduce
Compile the code generated for any request with Swift 5.x and the following error is produced:

error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let task = URLSession.shared.dataTask(with: request) { data, response, error in 

Expected code snippet and corresponding request
The following code should be present in the generated code to work with Swift 5.x:

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant