A type that defines the geometry of a scroll view.
SwiftUI provides you values of this type when using modifiers like
``View/onScrollGeometryChange(_:action:)`` or
``View/onScrollPhaseChange(_:)``.
Members (12)
get · iOS 18.0+
contentSize
TypeScript
get contentSize(): { width: number; height: number }
Swift declaration
var contentSize: CGSize
The size of the content of the scroll view.
Unlike the container size of the scroll view, this refers to the
total size of the content of the scroll view which can be smaller
or larger than its containing size.
set · iOS 18.0+
contentSize
TypeScript
set contentSize(value: { width: number; height: number })
Swift declaration
var contentSize: CGSize
The size of the content of the scroll view.
Unlike the container size of the scroll view, this refers to the
total size of the content of the scroll view which can be smaller
or larger than its containing size.
get · iOS 18.0+
visibleRect
TypeScript
get visibleRect(): { x: number; y: number; width: number; height: number }
Swift declaration
var visibleRect: CGRect { get }
The visible rect of the scroll view.
This value is computed from the scroll view's content offset, content
insets, and its container size.
get · iOS 18.0+
containerSize
TypeScript
get containerSize(): { width: number; height: number }
Swift declaration
var containerSize: CGSize { get set }
The size of the container of the scroll view.
This is the overall size of the scroll view. Combining this
and the content offset will give you the current visible rect
of the scroll view.
set · iOS 18.0+
containerSize
TypeScript
set containerSize(value: { width: number; height: number })
Swift declaration
var containerSize: CGSize { get set }
The size of the container of the scroll view.
This is the overall size of the scroll view. Combining this
and the content offset will give you the current visible rect
of the scroll view.
get · iOS 18.0+
contentInsets
TypeScript
get contentInsets(): EdgeInsets
Swift declaration
var contentInsets: EdgeInsets
The content insets of the scroll view.
Adding these insets to the content size of the scroll view
will give you the total scrollable space of the scroll view.
set · iOS 18.0+
contentInsets
TypeScript
set contentInsets(value: EdgeInsets)
Swift declaration
var contentInsets: EdgeInsets
The content insets of the scroll view.
Adding these insets to the content size of the scroll view
will give you the total scrollable space of the scroll view.
init · iOS 18.0+
init
TypeScript
static init(contentOffset: { x: number; y: number }, contentSize: { width: number; height: number }, contentInsets: EdgeInsets, containerSize: { width: number; height: number }): ScrollGeometry
The content offset of the scroll view.
This is the position of the scroll view within its overall
content size. This value may extend before zero or beyond
the content size when the content insets of the scroll view
are non-zero or when rubber banding.
set · iOS 18.0+
contentOffset
TypeScript
set contentOffset(value: { x: number; y: number })
Swift declaration
var contentOffset: CGPoint { get set }
The content offset of the scroll view.
This is the position of the scroll view within its overall
content size. This value may extend before zero or beyond
the content size when the content insets of the scroll view
are non-zero or when rubber banding.
get · iOS 18.0+
debugDescription
TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }
A textual representation of this instance, suitable for debugging.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(reflecting:)`
initializer. This initializer works with any type, and uses the custom
`debugDescription` property for types that conform to
`CustomDebugStringConvertible`:
struct Point: CustomDebugStringConvertible {
let x: Int, y: Int
var debugDescription: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `debugDescription` property.
get · iOS 18.0+
bounds
TypeScript
get bounds(): { x: number; y: number; width: number; height: number }
Swift declaration
var bounds: CGRect { get }
The bounds rect of the scroll view.
Unlike the visible rect, this value is within the content insets
of the scroll view.