-
Notifications
You must be signed in to change notification settings - Fork 30
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
Cannot import FoundationNetworking #2316
Comments
Thanks for creating the issue @Sajjon. I've updated the SwiftWasm book chapter about Foundation to explicitly mention If making HTTP requests is something you're looking for, I recommend checking out OpenCombineJS, which can convert Does that resolve your issue? |
Thanks your prompt reply! I was hoping to have a complete Swift codebase (with networking in place) that I could just compile to WebAssembly using SwiftWasm. So your suggestion is not a feasible solution for me, and looks like I won't be able to achieve my goal just yet. Hopefully networking matures in WebAssembly land (and thus becomes ready for use with SwiftWasm). I applaud all your efforts with the SwiftWasm project, it really is amazing! Imagine Swift possibly someday being the language "of the web" 😍 |
Will close this issue for now, thanks! |
This is not a problem specific to WebAssembly, browsers have to implement a raw socket API first so that we can bridge it. There's nothing that prevents us from bridging it to WebAssembly if browsers supported this.
Thanks, I appreciate it! I think we're very close to it, we're working hard on improving libraries and tooling to achieve that. |
Ah, ok thanks! Sorry, I'm a complete web and WASM n00b so I have difficulties distinguishing between what's what and how each entity relate to an another (Swift, SwiftWasm, WebAssembly, Wasmer, Browsers...) 🤪 Btw, how close do you think we are for Apple to accept the work being doing in this Swift fork? And adopting SwiftWasm in the upstream (github.com/apple/swift)? Like 6 months, 1 year, 2 years? Impossible to say with accuracy of course, but what is your personal guess @MaxDesiatov ? :) Because the other day I saw that the Apple Documentation for |
While it wouldn’t be possible to use FoundationNetworking as-is, it should be possible to implement at least some of its (HTTP-based) APIs by wrapping JavaScript’s |
Possibly, but the problem is that Foundation is a "core" library that's part of the SDK distributed with the toolchain. We'd need to do the same for JavaScriptKit, which is blocked by swiftwasm/JavaScriptKit#61. There is also the runtime part of JavaScriptKit, which we currently distribute in |
How can I use URLSession? I tried importing
FoundationNetworking
but I can't get it to work.I use:
And compilation command:
swift build --triple wasm32-unknown-wasi
So then I try:
But that results in
main.swift:4:8: error: no such module 'FoundationNetworking' import FoundationNetworking
So then I try:
But that results in:
The text was updated successfully, but these errors were encountered: