Introducing WaterUI 0.2.0 - Using Reactive, hot reload and support Android for Rust GUI

⚓ Rust    📅 2025-12-14    👤 surdeus    👁️ 14      

surdeus

Warning

This post was published 54 days ago. The information described in this article may have changed.

waterui0.2.0

I started to create WaterUI since I love the idea of SwiftUI but was eager to bring it to all platforms with better type safety and performance. It is clean, ergonomic, and type-safe. I believe a GUI kit should not be write once, run anywhere but learn once, apply anywhere, since the differences between platforms cannot be fully encapsulated or erased.

Two months ago, I released WaterUI 0.1.0. It contains basic reactivity and native view rendering functionality, but users had to handle complex build configuration by themselves. There was a lack of components and examples, memory leak bugs, and support for only Apple platforms.

Today, we solved these most annoying issues in 0.1.0 by introducing a few enhancements:

  • A brand-new CLI tool water, a single binary without dependencies on cargo-ndk or cargo-xcode. Playground mode for fast launch and experimentation.
  • First-class Android support.
  • A brand-new, Rust-driven layout system, providing consistent layout behavior across platforms. Built-in stack, overlay, grid, etc., powered by the Layout trait and fully customizable.
  • Media components for displaying video or photos.
  • Refactored Apple backend, switching to UIKit/AppKit for better control.
  • Hot reload.
  • Theme system with dynamic fonts and colors.
  • WebGPU (HDR) and Canvas (SDR). (Note: Canvas functionality is only available on the dev branch, since Vello's released version doesn't upgrade to wgpu27 yet.)
  • Gestures, A11Y, Markdown, List, Table.

I worked on it for numerous hours, and I'm super happy to see so many people love it. I'm glad to listen to your feedback or for you to open an issue for feature requests on GitHub.

I wanna introduce some most interesting parts in this version here:

Cross-platform layout

We introduced a crate waterui-layout, to provide cross-platform layout experience

pub trait Layout: Debug {
    /// Determines the size of the container based on the parent's proposal and children's responses.
    fn size_that_fits(&self, proposal: ProposalSize, children: &mut [&mut dyn SubView]) -> Size;

    /// Calculates the position (Rect) for each child within the final bounds.
    fn place(&self, bounds: Rect, children: &mut [&mut dyn SubView]) -> Vec<Rect>;
}

image

Hot reload

WaterUI CLI would monitor the file system changes and rebuild a dylib sending to your app, then your app would reload instantly.

2025-12-14 13.55.53

Dynamic color and font

We utilize our environment system, allowing Color and Font in WaterUI responding to environment reactively. We can simply use Body in your code. And its font size would decided dynamically.

pub trait Resolvable: Debug + Clone {
    /// The concrete type produced after resolution.
    type Resolved;

    /// Resolves this value in the given environment, returning a reactive signal.
    ///
    /// The returned signal will emit the current resolved value and any future updates.
    /// Callers typically use `.get()` for one-shot reads or subscribe for continuous updates.
    fn resolve(&self, env: &Environment) -> impl Signal<Output = Self::Resolved>;
}

image

BTW: Now we have an official website. It looks nice!

1 post - 1 participant

Read full topic

🏷️ Rust_feed