ScrollGeometry

A type that defines the geometry of a scroll view.

StructureiOS 18.0+macOS 15.0+tvOS 18.0+watchOS 11.0+visionOS 2.0+ScrollGeometry in SwiftUI

Declaration

React
type ScrollGeometry = { readonly bounds: CGRect; readonly containerSize: CGSize; readonly contentInsets: EdgeInsets; readonly contentOffset: CGPoint; readonly contentSize: CGSize; readonly debugDescription: string; readonly visibleRect: CGRect; };
Swift
struct ScrollGeometry

Properties

  • bounds*CGRect

    The bounds rect of the scroll view.

  • containerSize*CGSize

    The size of the container of the scroll view.

  • contentInsets*EdgeInsets

    The content insets of the scroll view.

  • contentOffset*CGPoint

    The content offset of the scroll view.

  • contentSize*CGSize

    The size of the content of the scroll view.

  • debugDescription*string

    A textual representation of this instance, suitable for debugging.

  • visibleRect*CGRect

    The visible rect of the scroll view.

Overview

SwiftUI provides you values of this type when using modifiers like View.onScrollGeometryChange(_:action:) or View.onScrollPhaseChange(_:).

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Layout.