Nuit

Build

A declarative, cross-platform UI library for Rust that uses native controls.

Nuit's API takes inspiration from SwiftUI, Xilem, React and a number of other frameworks, while itself using SwiftUI under the hood on macOS.

Note that Nuit currently requires using a nightly Rust toolchain as it uses some unstable compiler features, e.g. impl Trait in type aliases, associated type defaults and the never type !. With rustup this can be configured conveniently on a per-directory basis: rustup override set nightly

Example

```rust use nuit::{Text, VStack, View, Bind, Button, State};

[derive(Bind)]

struct CounterView { count: State, }

impl CounterView { fn new() -> Self { Self { count: State::new(0) } } }

impl View for CounterView { type Body = impl View;

fn body(&self) -> Self::Body {
    let count = self.count.clone();
    VStack::new((
        Text::new(format!("Count: {}", count.get())),
        Button::new(Text::new("Increment"), move || {
            count.set(count.get() + 1);
        })
    ))
}

}

fn main() { nuit::run_app(CounterView::new()); } ```

Running this example, e.g. with cargo run --example counter, launches: