Compile Swift to Wasm WASI
wasienv install-swiftif CommandLine.arguments.count < 2 {
print("Hello, WASI!");
} else {
print("Hello, \(CommandLine.arguments[1])");
}for i in 1...100
{
if i % 3 == 0 && i % 5 == 0 {
print("FizzBuzz")
} else if i % 3 == 0 {
print("Fizz")
} else if i % 5 == 0 {
print("Buzz")
} else {
print(i)
}
}wasiswiftc example.swift -o example.wasm$ wasmer example.wasm
Hello, WASI!Last updated