swiftui-native 0.0.1

SwiftUI from pure Rust — no Swift bridge, no shim, only swift-runtime calls
Documentation
//! The `swiftui!` macro against the DSL it lowers to.
use swiftui_native::{prelude::*, swiftui, views};

fn main() {
    let show_detail = true;
    let items = vec![String::from("alpha"), String::from("beta")];

    let sugared = swiftui! {
        VStack(spacing: 8.0) {
            Text("Title").text_style(.large_title)
            if show_detail {
                Text("the details")
            }
            ForEach(items) { item in
                Text(item)
            }
        }
    };

    let by_hand = vstack_spacing(
        &[
            text("Title").text_style(views::TextStyle::LargeTitle),
            conditional(show_detail, text("the details"), empty()),
            for_each_items(&items, |item| text(item)),
        ],
        8.0,
    );

    let a = views::dump_value_to_depth(&sugared.into_handle(), 6);
    let b = views::dump_value_to_depth(&by_hand.into_handle(), 6);
    eprintln!("macro == hand-written? {}", a == b);
    if a != b {
        for (x, y) in a.lines().zip(b.lines()) {
            if x != y {
                eprintln!("  macro: {}\n  hand : {}", x.trim(), y.trim());
                break;
            }
        }
    }
}