WebAssembly Runtime written in Swift
WasmKit is a standalone and embeddable WebAssembly runtime (virtual machine) implementation and related tooling written in Swift. Starting with Swift 6.2, WasmKit CLI executable is included in Swift toolchains distributed at swift.org for Linux and macOS.
You can find introductory examples and API documentation on the Swift Package Index documentation page.
WasmKit provides a command line tool to run WebAssembly binaries compatible with WASI.
$ git clone https://github.com/swiftwasm/WasmKit.git
$ cd WasmKit
$ swift run wasmkit-cli run ./Examples/wasm/hello.wasm
Hello, World!
To use WasmKit in your package, add it as a Swift Package Manager dependency.
Run the following commands in the same directory as your Package.swift manifest to add the dependency:
swift package add-dependency https://github.com/swiftwasm/WasmKit --up-to-next-minor-from 0.5.1
swift package add-target-dependency WasmKit <your-package-target-name> --package WasmKit
You can also add the following snippet manually instead to your Package.swift file:
dependencies: [
// ...other dependencies
.package(url: "https://github.com/swiftwasm/WasmKit.git", .upToNextMinor(from: "0.5.1")),
],
// ...other package configuration
targets: [
// ...other targets
.target(
name: "<your-package-target-name>",
dependencies: [.product(name: "WasmKit", package: "WasmKit")],
)
]
WasmKit engine works on all major platforms supported by Swift. It is continuously tested on macOS, Ubuntu, Amazon Linux 2023, Android, and Windows, and should work on the following platforms:
| Feature | Status |
|---|---|
| Parsing binary format | ✅ Implemented |
| Parsing text format (WAT) | ✅ Implemented |
| Execution | ✅ Implemented |
| Validation | ✅ Implemented |
Proposals are grouped by their phase in the standardization process. See the WebAssembly proposals repository for details.
| Proposal | Status | WasmKit version |
|---|---|---|
| Bulk Memory Operations | ✅ Implemented | 0.0.2 |
| Exception Handling | ✅ Implemented | 0.3.0 |
| Fixed-width SIMD | ✅ Implemented | 0.3.0 |
| Import/Export of Mutable Globals | ✅ Implemented | 0.0.2 |
| Memory64 | ✅ Implemented | 0.0.2 |
| Multi-value | ✅ Implemented | 0.0.2 |
| Non-trapping Float-to-Int Conversions | ✅ Implemented | 0.0.2 |
| Reference Types | ✅ Implemented | 0.0.2 |
| Sign-extension Operators | ✅ Implemented | 0.0.2 |
| Tail Call | ✅ Implemented | 0.1.4 |
| Typed Function References | ✅ Implemented | 0.4.1 |
| Branch Hinting | ❌ Not implemented | |
| Custom Annotation Syntax in the Text Format | ✅ Implemented | 0.4.2 |
| Extended Constant Expressions | ✅ Implemented | 0.4.0 |
| Garbage Collection | ❌ Not implemented | |
| Multiple Memories | ✅ Implemented | 0.4.2 |
| Relaxed SIMD | ✅ Implemented | 0.4.0 |
| Proposal | Status | WasmKit version |
|---|---|---|
| Threads and Atomics | ✅ Implemented | 0.3.0 |
| Wide Arithmetic | ✅ Implemented | 0.5.0 |
| Proposal | Status | WasmKit version |
|---|---|---|
| [Component Model](https://gith |
No good first issue or help wanted issues are currently available.
No CONTRIBUTING document was found. Please check the README and open issues.