Skip to content

Commit 734ec3c

Browse files
Documentation: Update Hello World tutorial prerequisites for Swift 6.2.1
1 parent 3ff42c3 commit 734ec3c

9 files changed

+62
-25
lines changed

Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,35 @@
66
}
77

88
@Section(title: "Prerequisites") {
9-
Visit the [installation guide](https://book.swiftwasm.org/getting-started/setup.html) to install the Swift SDK for WebAssembly before starting this tutorial.
10-
This tutorial assumes you have the Swift SDK for WebAssembly installed. Please check your Swift installation.
9+
This tutorial requires the OSS Swift Toolchain and Swift SDK for WebAssembly to be installed. Follow these steps to set up your development environment for building web applications with JavaScriptKit.
1110

1211
@Steps {
1312
@Step {
14-
Check your Swift toolchain version. If you see different
15-
@Code(name: "Console", file: "hello-world-0-1-swift-version.txt")
13+
Install `swiftly`, the Swift toolchain installer, per the [instructions on swift.org](https://www.swift.org/install/) for your platform.
14+
15+
`swiftly` is the recommended way to install and manage OSS Swift toolchains. You cannot use toolchains bundled with Xcode for WebAssembly development.
16+
@Code(name: "Console", file: "hello-world-0-0-install-swiftly.txt")
17+
}
18+
19+
@Step {
20+
Install the latest Swift 6.2 development snapshot using `swiftly`:
21+
22+
@Code(name: "Console", file: "hello-world-0-1-install-toolchain.txt")
1623
}
24+
25+
@Step {
26+
Install the Swift SDK for WASI that matches your toolchain version:
27+
28+
Navigate to [the downloads page](https://www.swift.org/download/) and find the "Swift SDK for WASI" section. Find a version that **exactly** matches the toolchain version from step 2.
29+
30+
@Code(name: "Console", file: "hello-world-0-2-install-sdk.txt")
31+
}
32+
1733
@Step {
18-
Select a Swift SDK for WebAssembly version that matches the version of the Swift toolchain you have installed.
34+
Verify the Swift SDK installation and set up your environment:
1935

2036
The following sections of this tutorial assume you have set the `SWIFT_SDK_ID` environment variable.
21-
@Code(name: "Console", file: "hello-world-0-2-select-sdk.txt")
37+
@Code(name: "Console", file: "hello-world-0-3-verify-sdk.txt")
2238
}
2339
}
2440
}
@@ -98,4 +114,4 @@
98114
}
99115
}
100116
}
101-
}
117+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Install swiftly per the instructions for your platform
2+
# Visit https://www.swift.org/install/ for platform-specific instructions
3+
4+
# Example for macOS:
5+
$ curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg && \
6+
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory && \
7+
~/.swiftly/bin/swiftly init --quiet-shell-followup && \
8+
. "${SWIFTLY_HOME_DIR:-$HOME/.swiftly}/env.sh" && \
9+
hash -r
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Install latest 6.2 development snapshot
2+
$ swiftly install 6.2.1
3+
Installing Swift 6.2.1...
4+
Swift 6.2.1 installed successfully.
5+
6+
# Select the installed toolchain
7+
$ swiftly use 6.2.1
8+
Using Swift 6.2.1
9+
10+
# Verify the toolchain is active
11+
$ swift --version
12+
Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)
13+
or
14+
Swift version 6.2.1 (swift-6.2.1-RELEASE)

Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-swift-version.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Navigate to https://www.swift.org/download/ and find the "Swift SDK for WASI" section
2+
# Find a URL that exactly matches your toolchain version from the previous step
3+
# Press "Copy install command" to get the installation command
4+
5+
# Example installation command (replace with the exact command from swift.org):
6+
$ swift sdk install https://download.swift.org/swift-6.2.1-release/wasm-sdk/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE_wasm.artifactbundle.tar.gz --checksum 482b9f95462b87bedfafca94a092cf9ec4496671ca13b43745097122d20f18af

Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-select-sdk.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Verify the Swift SDK was installed
2+
$ swift sdk list
3+
swift-6.2.1-RELEASE_wasm
4+
swift-6.2.1-RELEASE_wasm-embedded
5+
6+
# In this tutorial, we use non-embedded SDK.
7+
# Set the SDK ID as an environment variable for convenience
8+
$ export SWIFT_SDK_ID=swift-6.2.1-RELEASE_wasm

Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Creating .gitignore
55
Creating Sources/
66
Creating Sources/main.swift
77

8-
$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --branch main
8+
$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0
99
Updating package manifest at Package.swift... done.

Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Creating .gitignore
55
Creating Sources/
66
Creating Sources/main.swift
77

8-
$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --branch main
8+
$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0
99
Updating package manifest at Package.swift... done.
1010

1111
$ swift package add-target-dependency --package JavaScriptKit JavaScriptKit Hello

0 commit comments

Comments
 (0)