macro_rules! view_if {
($cond:expr, $then:expr $(,)?) => { ... };
($cond:expr, $then:expr, $else:expr $(,)?) => { ... };
}Expand description
A ViewBuilder-style conditional that keeps each branch’s identity.
Unlike a plain Rust if, which picks a view and erases the branch, this
builds a _ConditionalContent — so SwiftUI sees a branch change and can
run insertion and removal transitions, and each arm keeps its own state.
ⓘ
view_if!(is_open, text("open"), text("closed"))