struct ComposedOverlayView
Swift
struct ComposedOverlayView<Content, OverlayContent> where Content : View, OverlayContent : View
A base view with content drawn over it, taking no layout space.
Distinct from overlay(isPresented:), which is a popup: that one detaches
its subtree, emits it after the whole tree walk to escape clipping, takes
input priority, and dismisses on an outside click. Those semantics are right
for a menu and wrong for anything permanent — an always-present button
presented that way makes the window behave like an open menu, swallowing
clicks that land anywhere else.
This is the composition variant: a floating action button, a badge on a corner, a control that belongs on a canvas rather than beside it. It is an absolutely positioned Yoga child, which buys all four required behaviours from the layout engine rather than from special cases:
- No layout contribution. An absolute child is not part of its parent's flex flow, so the base view measures exactly as it did without the overlay.
- Painted above. Emission is in
childNodesorder and the overlay is declared second, so it lands on top of the base. - Ordinary hit testing. It is a real node with real geometry; the hit walk visits children in reverse, so the overlay is tested before the base and everything else behaves normally. No priority, no dismissal.
- Anchored. Yoga edge insets do the placement, so it survives resizes without a re-layout pass of its own.
Sources/LavaUI/ComposedOverlay.swift:33
Constructors
init(content: Content, overlayContent: OverlayContent, anchor: OverlayAnchor, inset: Float, style: OverlayStyle? = nil)
Creates an overlay. Usually spelled .overlay(alignment:inset:style:content:).
Sources/LavaUI/ComposedOverlay.swift:54
Properties
var anchor: OverlayAnchor
Which point of the base view's box the overlay is pinned to.
Sources/LavaUI/ComposedOverlay.swift:39
var content: Content
The base view, which alone decides the size of the box.
Sources/LavaUI/ComposedOverlay.swift:35
var dumpDetail: String { get }
Not documented.
Sources/LavaUI/ComposedOverlay.swift:68
var inset: Float
Distance in points between the overlay and the anchored edges. A centred axis ignores it.
Sources/LavaUI/ComposedOverlay.swift:41
var overlayContent: OverlayContent
The view floated over the base.
Sources/LavaUI/ComposedOverlay.swift:37
var style: OverlayStyle?
Panel styling for the floating surface, or nil to draw no surface at all — a bare badge or button that is only its own content.
Optional here and not in OverlayView because the two have different
defaults for good reason. A popup is a surface by definition: a menu
with no plate under it is unreadable over whatever it covers. Composed
content is usually already a styled thing of its own, and giving it a
theme-coloured plate it never asked for would put a rectangle behind
every floating button in the codebase.
Sources/LavaUI/ComposedOverlay.swift:51
Methods
func mountPrimitive() -> any AnyViewNode
Not documented.
Sources/LavaUI/ComposedOverlay.swift:80
func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode
Not documented.
Sources/LavaUI/ComposedOverlay.swift:93
func structureLines(indent: Int = 0) -> [String]
Not documented.
Sources/LavaUI/ComposedOverlay.swift:70