Simplify examples
SwiftWebAssembly has one purpose, to load WebAssembly compiled modules and exposes them to Swift.
import SwiftWebAssembly import JavaScriptCore let context = JSContext() let file = URL(fileURLWithPath: "example.wasm") let data = try! Data(contentsOf: file) context.loadWebAssemblyModule(data: data, success: { exports in let result = exports?["add"]?.call(withArguments: [1, 2]) print("result: \(result)") // result: 3 })
The package can be installed through SwiftPM.
.package(url: "git@github.com:therealbnut/SwiftWebAssembly.git", from: "0.2.0"),
A more complete example:
// swift-tools-version:4.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyPackage", products: [ .library(name: "MyProduct", targets: ["MyTarget"]), ], dependencies: [ .package(url: "git@github.com:therealbnut/SwiftWebAssembly.git", from: "0.2.0"), ], targets: [ .target(name: "MyTarget", dependencies: ["SwiftWebAssembly"]) ] )
Add SwiftWebAssembly to your Cartfile.
SwiftWebAssembly

SwiftWebAssembly has one purpose, to load WebAssembly compiled modules and exposes them to Swift.
Example
Integration
Swift Package Manager
The package can be installed through SwiftPM.
A more complete example:
Carthage
Add SwiftWebAssembly to your Cartfile.