-
-
Notifications
You must be signed in to change notification settings - Fork 136
Avoid using Foundation when it is unavailable #32
Conversation
Interesting! Thanks for the patch, @MaxDesiatov. Just one suggested change to consolidate some duplicated logic. I've been watching WASM support from a distance for a while. Where do you think everything is at now? What needs to happen before we can start using this for real? (Are there blocking technical issues, or do things basically work, and it's just a matter of documenting and motivating use to the community at large?) |
Co-Authored-By: Mattt <[email protected]>
Perfect. Thanks again for your help with this, @MaxDesiatov! |
@mattt If you don't care about binary size, it's more or less usable right now as in this demo. Swift can't run dead code elimination on unused protocol conformances yet, so the minimum produced binary size is ~10M and ~1.5M when optimized and compressed, as tracked in swiftwasm/swift#7. Building with SwiftPM works, as long as you don't use Foundation or Dispatch due to a few technical reasons (swiftwasm/swift#592, swiftwasm/swift#658, swiftwasm/swift#647), but I hope that a minimalistic bare-bones subset of Foundation can alleviate that pain in the meantime. Interacting with DOM works through JavaScriptKit built by @kateinoigakukun, also big thanks to him for the Game of Life demo. I honestly didn't expect that we actually have SwiftPM and DOM interaction working at this point before I saw the demo in action 🤩
As soon as tests work, I want to get back to implementing a SwiftUI renderer for DOM. I have a reconciler that worked for iOS and macOS renderers last year before SwiftUI was announced. Although its public API was modeled after React at that time, it was relatively easy to repurpose the internals for the SwiftUI API, there's a test renderer now in the codebase that passes basic tests when compiled for macOS. Now it's just a matter of verifying that runtime reflection works well when running in browsers and then implemeninting the DOM renderer that matches Overall, I think it's in the state now where any help from the community would be greatly appreciated. Everyone can now install the SwiftWasm locally with Thanks for considering the patch, and many thanks for reading this 🙂 |
@MaxDesiatov This is tremendous, Max. (Also, that @kateinoigakukun is next-level). Thanks for writing this up.
Count me in! I see WASM as a total game-changer, both for Swift and software in general. Consider whatever reach I have with @NSHipster to be at your disposal. |
Foundation is not available on platforms such as SwiftWasm, this change allows the library to be compiled for such platforms.