Swift for WebAssembly - How To Use Swift In Your Web App
summary
Shows how to compile Swift to WebAssembly using the Carton plugin and the SwiftWasm toolchain, load modules in a normal web app and run them with runtimes like wasmer, and call JS via JavaScriptKit; distinguishes command vs reactor modules (start vs initialize) and exporting functions with Swift 6’s @expose wasm / C calling convention. Demos include a hello world, a dice button, a live graph, and a multiplayer Connect‑4 that reuses 100% of domain logic across web front end and a Vapor backend — all working live.
AI-written summary · about
chapters (10)
- 0:00Introduction to Swift for WebAssembly
- 9:30Hello World with Carton
- 18:10Custom HTML with JavaScript Kit
- 25:20Manual WebAssembly Module Compilation
- 34:14Loading Module in Web App
- 35:17Reactor vs Command Modules
- 40:58Exporting Functions to WebAssembly
- 44:54Importing JavaScript Functions
- 46:19Multiplatform Connect 4 Demo
- 50:13Future of Swift and WebAssembly








