/AsyncifySample

SwiftWasm Asyncify Sample

Primary LanguageSwift

SwiftWasm Asyncify Sample

Showcase SwiftWasm code that's impossible to accomplish without Asyncify method:

  • Sleeping inside synchronous code, without resorting to callback (or Swift Next's async/await).
  • An initializer (which needs to return synchronously) that depends on asynchronous code from the outside world.

Prerequisites

  • Install the SwiftWasm toolchain
  • Set SwiftWasm's swift as default or edit the swift command in build.sh.
  • Install the Binaryen toolchain (we'll use the wasm-opt tool from there).
  • Set Binaryen's /bin in PATH or edit the wasm-opt command in build.sh.

Building Javascript

npm install
npm run build

Building Swift

./build.sh

Output files are written to /dist folder.