One Logo Pool Ball
SwiftUI · IOS API REFERENCE

ScrollAnchorRole

struct · iOS 18.0+ · SDK 27.1

struct ScrollAnchorRole

A type defining the role of a scroll anchor. You can associate a ``UnitPoint`` to a ``ScrollView`` using the ``View/defaultScrollAnchor(_:)`` modifier. By default, the system uses this point for different kinds of behaviors including: - Where the scroll view should initially be scrolled - How the scroll view should handle content size or container size changes - How the scroll view should align content smaller than its container size You can further customize this behavior by assigning different unit points for these different roles.

Members (3)

get · iOS 18.0+

sizeChanges

TypeScript
static get sizeChanges(): ScrollAnchorRole
Swift declaration
static var sizeChanges: ScrollAnchorRole { get }

The role that influences how a scroll view should adjust its content offset when the scroll view's content or container size changes.

get · iOS 18.0+

initialOffset

TypeScript
static get initialOffset(): ScrollAnchorRole
Swift declaration
static var initialOffset: ScrollAnchorRole { get }

The role that influences where a scroll view should be initially scrolled.

get · iOS 18.0+

alignment

TypeScript
static get alignment(): ScrollAnchorRole
Swift declaration
static var alignment: ScrollAnchorRole { get }

The role that influences how a scroll view should align its content when the size of its content is smaller than the container size of the scroll view.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →