WasmKit is a standalone and embeddable WebAssembly runtime implementation written in Swift.
WasmKit provides a command line tool to run WebAssembly binaries compliant with WASI.
$ git clone https://github.com/swiftwasm/WasmKit.git
$ cd WasmKit
$ swift run wasmkit-cli run ./Examples/wasm/hello.wasm
Hello, World!
You can use WasmKit as a Swift Package Manager dependency by adding the following to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/swiftwasm/WasmKit.git", from: "0.0.5"),
],
You can find API documentation on the Swift Package Index.
Category | Feature | Status |
---|---|---|
WebAssembly MVP | Parsing binary format | ✅ Implemented |
Parsing text format (WAT) | ✅ Implemented | |
Execution | ✅ Implemented | |
Validation | 🚧 Partially implemented | |
WebAssembly Proposal | Reference types | ✅ Implemented |
Bulk memory operations | ✅ Implemented | |
Mutable globals | ✅ Implemented | |
Sign-extension operators | ✅ Implemented | |
Non-trapping float-to-int conversions | ✅ Implemented | |
Memory64 | ✅ Implemented | |
Threads and atomics | 🚧 Parser implemented | |
WASI | WASI Preview 1 | ✅ Implemented |
To run the WasmKit test suite, you need to checkout the test suite repositories first.
# Checkout test suite repositories
$ ./Vendor/checkout-dependency
# Run tests
$ swift test
This project is originally developed by @akkyie, and now maintained by the community.