Skip to main content

app/
app.rs

1//! A SwiftUI app from pure Rust — no Swift source code.
2//!
3//! ```bash
4//! cargo run -p swiftui-native --example app
5//! ```
6
7use swiftui_native::prelude::*;
8
9fn main() {
10    run(|| {
11        vstack(&[
12            text("Hello from Rust! 🦀")
13                .padding(12.0)
14                .bg(Color::BLUE)
15                .rounded(8.0)
16                .opacity(0.95),
17            spacer(),
18            hstack(&[
19                image("star.fill"),
20                text("No Swift compiler needed"),
21            ]),
22            divider(),
23            text("Pure dlsym + arm64 asm → SwiftUI")
24                .padding(8.0),
25        ])
26        .padding(40.0)
27        .into_handle()
28    });
29}