Skip to content

Mobile Development ​

Cross-compile Wyn to native arm64 binaries for iOS and Android.

Mobile support today covers the compiled core of an app: develop and test the logic on your desktop, then produce a device-architecture binary with wyn cross. The platform UI shell (which would turn wyn_ui_* calls into real widgets and produce an installable .app/.apk) is not shipped yet, so the wyn_* mobile functions are stubs you declare yourself.

iOS App Shape ​

wyn
// Mobile SDK stubs - declare these yourself for now
fn wyn_ui_text(ctx: int, text: string, size: int) {}
fn wyn_ui_spacer(ctx: int, size: int) {}
fn wyn_ui_button(ctx: int, label: string, id: int) {}
fn wyn_ios_main(a: int, b: int) -> int { return 0 }

fn wyn_app_title() -> string {
    return "My App"
}

fn wyn_app_build(ctx: int) {
    wyn_ui_text(ctx, "Hello World!", 28)
    wyn_ui_spacer(ctx, 16)
    wyn_ui_button(ctx, "Tap Me", 1)
}

fn wyn_on_button(id: int) {
    println("Button tapped!")
}

fn main() -> int {
    return wyn_ios_main(0, 0)
}

Cross-compile for iOS ​

Requires Xcode's iOS SDK (Command Line Tools alone are not enough):

bash
wyn cross ios app.wyn
# Produces app.wyn.ios (arm64 Mach-O, min iOS 15)

Cross-compile for Android ​

Requires the Android NDK (Android Studio, SDK Manager, NDK):

bash
wyn cross android app.wyn
# Produces app.wyn.android (arm64)

The output is a bare executable, not an installable app bundle. Shipping to a device still requires an Xcode or Gradle host project that embeds the binary, plus signing. CLI packaging to .app/.apk is on the roadmap.

Planned Shell Contract ​

The stub names are the planned contract with the future platform shell:

FunctionMaps to (planned)Description
wyn_ui_text(ctx, text, size)UILabelDisplay text
wyn_ui_button(ctx, title, id)UIButtonTappable button
wyn_ui_spacer(ctx, height)UIViewVertical spacing

On mobile builds the runtime already guards desktop-only behavior: System::exec returns an empty string and Process::exec_status returns -1 instead of shelling out.

Fast Iteration ​

bash
wyn watch app.wyn

Edit, save, and wyn watch rebuilds and reruns automatically. Develop the app logic on your desktop with stubs, then wyn cross ios/android to produce the device binary.

See Also ​

MIT License - v1.21.0