Expand description
Declarative macros for building view trees.
The function forms take slices, which means spelling out &[...] and often a
Vec when children have different origins. These macros take a plain,
comma-separated list instead, so a tree reads top to bottom the way the
SwiftUI it mirrors does:
ⓘ
use swiftui_native::prelude::*;
let ui = vstack![
text("Dashboard").text_style(TextStyle::Title),
divider(),
hstack![image("star.fill"), text("starred"), spacer()],
zstack![
rounded_rectangle(12.0).fg(Color::hex(0x2E86DE)),
text("badge").fg(Color::WHITE),
],
]
.padding(20.0);Every element goes through IntoView, so string
literals can be written directly:
ⓘ
vstack!["first", "second", text("third").bold()]A trailing comma is allowed everywhere.