Mobile Development
Build native iOS and Android apps in Wyn.
iOS App
wyn
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)
}Package for iOS
bash
wyn package ios app.wyn --name MyApp --id com.example.myapp
# Creates MyApp.app (signed, ready for device)Package for Android
bash
wyn package android app.wyn --name MyApp --id com.example.myapp
# Creates MyApp.apk (signed with debug key)UI Components
| Function | iOS | Description |
|---|---|---|
wyn_ui_text(ctx, text, size) | UILabel | Display text |
wyn_ui_button(ctx, title, id) | UIButton | Tappable button |
wyn_ui_spacer(ctx, height) | UIView | Vertical spacing |
Mobile APIs
wyn
// Storage (persists across app launches)
wyn_storage_set("key", "value")
var val = wyn_storage_get("key")
// Clipboard
wyn_clipboard_set("copied text")
var text = wyn_clipboard_get()
// Notifications
wyn_notify("Title", "Body text")
// Haptic feedback
wyn_vibrate()Hot Reload
During development, use wyn hot for instant code reloading:
bash
wyn hot app.wyn
# [hot] watching app.wyn (Ctrl+C to stop)
# [hot] reload #1
# Hello World!
# ... edit app.wyn ...
# [hot] reload #2
# Hello Updated World!Changes are compiled and reloaded via dlopen — no restart needed.
See Also
- Cross-Compilation — build for other platforms
- Installation — install Wyn