You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/articles/wasm-getting-started.md
+24-14Lines changed: 24 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,26 +13,27 @@ WebAssembly support in Swift started out as a community project. Any instruction
13
13
standardized ABI and system interfaces, and from its inception Wasm support in Swift targeted [WebAssembly System
14
14
Interface](https://wasi.dev/), which made porting Swift core libraries to this platform much easier.
15
15
16
-
With Swift 6.2 and development snapshots you can easily cross-compile and run Wasm modules with Swift SDKs for Wasm distributed on [swift.org](https://swift.org/download).
16
+
Starting with Swift 6.2 and development snapshots you can easily cross-compile and run Wasm modules with Swift SDKs for Wasm distributed on [swift.org](https://swift.org/download).
17
17
The distributed artifact bundles also include support for the experimental Embedded Swift mode.
18
18
19
19
## Installation
20
20
21
-
1.[Install `swiftly` per the instructions](https://www.swift.org/install/) for the platform that you're bulding on.
22
-
23
-
2. Install Swift 6.2 with `swiftly install 6.2`, note the exact snapshot date component in the output of this command.
3. Select the installed toolchain with `swiftly use {{ release_name }}`.
35
35
36
+
4. Run a command in your terminal application to install Swift SDKs for Wasm.
36
37
```
37
38
{{ command }}
38
39
```
@@ -76,15 +77,15 @@ struct wasi_test {
76
77
Build your package with the following command, substituting the ID from step 5 of [the "Installation" section](#installation) above.
77
78
78
79
```
79
-
swift build --swift-sdk swift-6.2-RELEASE_wasm
80
+
swift build --swift-sdk {{ tag }}_wasm
80
81
```
81
82
82
83
Recent toolchain snapshots that are compatible with Swift SDKs for Wasm also include
83
84
[WasmKit](https://github.com/swiftwasm/wasmkit/), which is a Wasm runtime that `swift run` can delegate to for
84
85
execution. To run the freshly built module, use `swift run` with the same `--swift-sdk` option:
85
86
86
87
```
87
-
swift run --swift-sdk swift-6.2-RELEASE_wasm
88
+
swift run --swift-sdk {{ tag }}_wasm
88
89
```
89
90
90
91
You should see the following output:
@@ -103,5 +104,14 @@ Hello from WASI!
103
104
allowing the toolchain to produce Wasm binaries that are multiple orders of magnitude smaller. One of the Swift SDKs in the artifact bundle you've installed
104
105
with the `swift sdk install` command is tailored specifically for Embedded Swift.
105
106
106
-
To build with Embedded Swift SDK, pass its ID as noted in `swift sdk list` output (which has an `-embedded` suffix) in the `--swift-sdk` option.
107
+
To build with Embedded Swift SDK, pass its ID as noted in `swift sdk list` output (which has an `-embedded` suffix) in the `--swift-sdk` option. For example:
0 commit comments