The first milestone for Xwift was deliberately modest: take one ordinary SwiftPM package and get it building, testing and running on as many targets as possible, using only stock tools from swift.org. Here is what that looks like.
The package
The package, Xwift, has three targets:
XwiftCore, a library exposingPlatformInfo.current(operating system, architecture, pointer width) and agreeting()helper.xwift-hello, an executable that prints a greeting for the platform it was compiled for.XwiftCoreTests, tests written with both XCTest and swift-testing.
import XwiftCore
print(greeting())PlatformInfo is resolved entirely at compile time with #if os(…) and #if arch(…), so the same source produces a different answer per target:
public var description: String {
"\(os.rawValue)-\(architecture.rawValue) (\(pointerBitWidth)-bit)"
}The pinned toolchain
The proof of concept uses stock swift.org releases. The Xwift toolchain is separate and has not been released.
| Component | Version |
|---|---|
| Swift toolchain | 6.4.1 (.swift-version) |
| Swift SDK for WebAssembly | swift-6.4.1-RELEASE_wasm |
| wasmtime | 38.0.1 |
The build matrix
The proof of concept was built in one GitHub Actions workflow with four jobs:
| Job | Runner | How Swift is installed | Steps |
|---|---|---|---|
| Linux (Ubuntu 24.04) | ubuntu-24.04 | swift:6.4.1-noble container | build, test, run |
| macOS | macos-15 | swiftly | build, test, run |
| Windows | windows-2022 | compnerd/gha-setup-swift | build, test, run |
| WebAssembly (WASI) | ubuntu-24.04 | swift:6.4.1-noble + Swift SDK for WebAssembly | build, run with wasmtime |
The WebAssembly job installed the SDK with a pinned checksum, built xwift-hello for wasm32, ran it with wasmtime and checked that the output contained wasi-wasm32:
swift sdk install https://download.swift.org/swift-6.4.1-release/wasm-sdk/swift-6.4.1-RELEASE/swift-6.4.1-RELEASE_wasm.artifactbundle.tar.gz \
--checksum 783e6128d174d9f975b4eda68be02a5960681b723ef372e6876a7c2543a365d8
swift build -c release --swift-sdk swift-6.4.1-RELEASE_wasm --product xwift-hello
wasmtime .build/release/xwift-hello.wasmEach job passed when this was written. That workflow no longer runs.
What this does not prove
It is worth being precise. This milestone shows that one small, dependency-free package compiles and runs on four targets with stock swift.org tools. It says nothing yet about:
- the Xwift toolchain, which is in progress and has not been released;
- Android or iOS, which were not in the matrix;
- the planned
xwiftCLI, UI framework or system APIs; - performance, binary size or larger real-world packages;
- running in a browser (the WebAssembly target today is WASI, run with wasmtime).
Those are the next chapters. You can reproduce everything above by following Getting started.