swiftui-native 0.0.1

SwiftUI from pure Rust — no Swift bridge, no shim, only swift-runtime calls
Documentation
//! Driving the Swift runtime directly: the ABI this crate speaks.
//!
//! Nothing here goes through a Swift source file. A SwiftUI view is built by
//! finding a mangled symbol with `dlsym`, arranging registers the way the
//! Swift compiler would have, and branching to it. That works because Swift's
//! arm64 convention is stable and documented — but three of its registers have
//! no counterpart in a Rust signature, so every call has to be written out:
//!
//! | register | role |
//! |----------|------|
//! | `x0`–`x7` | integer and pointer arguments, then any generic metadata, then any witness tables |
//! | `d0`–`d7` | floating-point arguments |
//! | `x8` | address of an indirect (`@out`) result |
//! | `x20` | the *self* register: a receiver, or a type's metadata for an initialiser or static |
//! | `x21` | the error register, which nothing here throws through and everything clobbers |
//!
//! Whether a value travels *in* a register or *by address* is the question
//! that decides whether a call works, and it is not visible in the symbol
//! name. A `@frozen` type of at most four registers is passed directly; a
//! resilient one is passed by address, because the caller is not allowed to
//! know its size. Two traps follow from that and both cost real time here:
//!
//! * An `Optional`'s payload is **not** destructured. `Optional<UnitPoint>` is
//!   two `CGFloat`s and a tag, and it arrives as three *integer* registers —
//!   a `Double` inside an optional reaches the callee in x0, not d0.
//! * Getting a return convention wrong rarely faults at the call. A function
//!   that writes through x8 while the caller reads x0 hands back a stale
//!   register, which SwiftUI stores and dereferences much later.
//!
//! [`call`] holds the primitives that make those choices explicit, and the
//! rest of this module is built on them:
//!
//! * `value` — enum tags, optionals, strings and arrays
//! * `metadata` — type metadata, witness tables and layout queries
//! * `modifier` — applying a `View` modifier and wrapping the result
//! * `closure` — Rust functions Swift can call back into


pub mod call;
mod closure;
mod metadata;
mod modifier;
mod value;
pub use call::{
    call_f64, call_out, call_regs, call_spilled, ints, static_out, static_regs, Floats, Ints,
};
use crate::resolve;

pub use closure::*;
pub use metadata::*;
pub use modifier::*;
pub use value::*;