You can also use SwiftPM for managing packages in the same way as other platforms.
$ swift package init --type executable Creating executable package: hello Creating Package.swift Creating README.md Creating .gitignore Creating Sources/ Creating Sources/hello/main.swift Creating Tests/ Creating Tests/LinuxMain.swift Creating Tests/helloTests/ Creating Tests/helloTests/helloTests.swift Creating Tests/helloTests/XCTestManifests.swift
You need to pass
--triple option, which indicates that you are building for the target.
$ swift build --triple wasm32-unknown-wasi
Just as in the previous section, you can run the produced binary with the
wasmer WebAssembly runtime.
$ wasmer ./.build/debug/hello-swiftwasm Hello, world!