struct VSplitView
Swift
struct VSplitView<Top, Bottom> where Top : View, Bottom : View
Two stacked panes with a draggable divider between them.
The split is stored as a fraction of the space the two panes share, not as
a height, so a window resize keeps the proportion the user chose instead of
growing one pane and pinning the other. minTop / minBottom are point
floors, which is what stops a pane being dragged away entirely.
VSplitView(fraction: $session.logSplit, minTop: 160, minBottom: 90) {
timeline
legend
} bottom: {
EditorView(text: $session.log).flexGrow(1)
}
Each pane is a column, like a VStack — several statements stack with the
theme's spacing. A pane's content is laid out inside a box whose height the
divider decides, so content that should fill its pane has to say so
(.flexGrow(1)); content that states its own height keeps it and is clipped
when the pane gets smaller than that.
The drag does not run bodies. A pointer move writes the new flex factors
straight onto the panes' Yoga nodes and asks for layout — for the same reason
Slider maintains its knob itself, a body pass per pointer pixel is
milliseconds of work between the hand and the pixels. The binding is written
once, on release. A view that displays the fraction therefore updates when
the drag ends, not during it.
HSplitView is the same thing on the other axis.
Sources/LavaUI/SplitView.swift:34
Constructors
init(fraction: Binding<Float>, minTop: Float = 60, minBottom: Float = 60, style: SplitStyle = SplitStyle(), @ViewBuilder top: () -> Top, @ViewBuilder bottom: () -> Bottom)
Split driven by app state, so it can be persisted or set from elsewhere.
Sources/LavaUI/SplitView.swift:47
init(initialFraction: Float = 0.5, minTop: Float = 60, minBottom: Float = 60, style: SplitStyle = SplitStyle(), @ViewBuilder top: () -> Top, @ViewBuilder bottom: () -> Bottom)
Split owned by the view itself. It survives rebuilds — the node holds it — but nothing outside can read or restore it.
Sources/LavaUI/SplitView.swift:66
Properties
var bottom: Bottom
Not documented.
Sources/LavaUI/SplitView.swift:44
var dumpDetail: String { get }
Not documented.
Sources/LavaUI/SplitView.swift:83
var fraction: Binding<Float>?
Where the app keeps the split, when it wants to keep it. nil leaves
the value on the node, which lives as long as the view does.
Sources/LavaUI/SplitView.swift:37
var initialFraction: Float
Used only at mount, when there is no binding to read.
Sources/LavaUI/SplitView.swift:39
var minBottom: Float
Not documented.
Sources/LavaUI/SplitView.swift:41
var minTop: Float
Not documented.
Sources/LavaUI/SplitView.swift:40
var style: SplitStyle
Not documented.
Sources/LavaUI/SplitView.swift:42
var top: Top
Not documented.
Sources/LavaUI/SplitView.swift:43
Methods
func mountPrimitive() -> any AnyViewNode
Not documented.
Sources/LavaUI/SplitView.swift:97
func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode
Not documented.
Sources/LavaUI/SplitView.swift:105
func structureLines(indent: Int = 0) -> [String]
Not documented.
Sources/LavaUI/SplitView.swift:87