struct ScrollView
Swift
struct ScrollView<Content> where Content : View
A clipped, scrollable container.
Generalises what EditorView already did for itself. The pieces it reuses —
scissor clipping, wheel routing, scroll clamping against a viewport measured
at emit time — all exist because a code editor needed them first; this is
mostly extraction.
Content is laid out at its natural size and allowed to overflow, which
is what YGOverflowScroll buys: without it Yoga compresses children to fit
the container and there is nothing left to scroll.
Sources/LavaUI/ScrollView.swift:14
Constructors
init(_ axis: ScrollAxis = .vertical, showsIndicator: Bool = true, indicatorInset: Float = 0, revealInset: Float = 0, position: ScrollPosition? = nil, followsEnd: Bool = false, @ViewBuilder content: () -> Content)
Creates a scroll view. Every parameter matches the property of the same name.
Sources/LavaUI/ScrollView.swift:45
Properties
var axis: ScrollAxis
The direction the content scrolls.
Sources/LavaUI/ScrollView.swift:16
var content: Content
The content, laid out at its natural size along axis.
Sources/LavaUI/ScrollView.swift:18
var dumpDetail: String { get }
Not documented.
Sources/LavaUI/ScrollView.swift:63
var followsEnd: Bool
Keeps growing content at the end until the reader scrolls away. Returning to the end resumes following. Off by default.
Sources/LavaUI/ScrollView.swift:42
var indicatorInset: Float
How far the indicator's track stops short of each end of the box.
The bar sits on the box's edge, so inside a rounded container it runs over the corners — pass the container's corner radius. The content is not inset: it still scrolls to the edge, under the curve.
Sources/LavaUI/ScrollView.swift:26
var position: ScrollPosition?
Where the view is, kept up to date as it scrolls, and a way to put it
somewhere. See ScrollPosition.
Sources/LavaUI/ScrollView.swift:39
var revealInset: Float
How much of the leading edge something floating over the view covers —
CSS's scroll-padding-top.
A reveal (a keyboard selection, .scrollIntoView) counts a box as
shown only below this band, so it lands under a floating search field
rather than behind it, and going back to the first row scrolls to the
top instead of stopping with that row under the field. It moves
nothing else: the content still starts at the top, and the wheel still
scrolls through the band.
Sources/LavaUI/ScrollView.swift:36
var showsIndicator: Bool
Draw a thin position indicator while the content overflows.
Sources/LavaUI/ScrollView.swift:20
Methods
func mountPrimitive() -> any AnyViewNode
Not documented.
Sources/LavaUI/ScrollView.swift:72
func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode
Not documented.
Sources/LavaUI/ScrollView.swift:83
func structureLines(indent: Int = 0) -> [String]
Not documented.
Sources/LavaUI/ScrollView.swift:65