Paul Krill
Editor at Large

Swift meets WebAssembly in SwiftWasm project

news
May 16, 20192 mins

Project aims to integrate a WebAssembly back-end into the Swift compiler, allowing Swift developers to build apps for the web browser

A new open source project called SwiftWasm aims to integrate a WebAssembly back-end into the official Swift compiler. The project, still in the earliest stages, would allow developers to use the Swift programming language to build applications that run in web browsers.

SwiftWasm compiles Swift code to WebAssembly, which provides a target binary format that allows languages besides JavaScript to be compiled to run in a browser. Developers can try Swift on WebAssembly now using SwiftWasm’s cloud-hosted toolchain, and run the resulting WebAssembly executables in both browsers and stand-alone WebAssembly runtimes. 

The SwiftWasm website includes a working demo, but notes that many features in Swift don’t work on WebAssembly yet. WebAssembly has attributes that present obstacles to Swift, the SwiftWasm developers noted, such as having strict function signature checking.

The creators of SwiftWasm hope to make Swift the “best language for cross-platform development.” Current work would become part of the Swift compiler and available to every Swift user out-of-the-box. Future plans include supporting developer tools to enable Swift developers targeting WebAssembly to be more productive.

Running Swift in the browser has been a goal as far back as 2014, when Apple first announced the language, Max Desiatov, a maintainer of SwiftWasm and software consultant, said. First there was a push to integrate Emscripten compiler infrastructure with Swift. When WebAssembly became available in major browsers, the focus shifted to LLVM compiler technology without Emscripten, Desiatov said.

Desiatov maintains a cross-platform UI framework for Swift called Tomakak.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author