One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

LayoutSubviews

struct · iOS 16.0+ · SDK 27.1

struct LayoutSubviews

A collection of proxy values that represent the subviews of a layout view. You receive a `LayoutSubviews` input to your implementations of ``Layout`` protocol methods, like ``Layout/placeSubviews(in:proposal:subviews:cache:)`` and ``Layout/sizeThatFits(proposal:subviews:cache:)``. The `subviews` parameter (which the protocol aliases to the ``Layout/Subviews`` type) is a collection that contains proxies for the layout's subviews (of type ``LayoutSubview``). The proxies appear in the collection in the same order that they appear in the ``ContentBuilder`` input to the layout container. Use the proxies to perform layout operations. Access the proxies in the collection as you would the contents of any Swift random-access collection. For example, you can enumerate all of the subviews and their indices to inspect or operate on them: for (index, subview) in subviews.enumerated() { // ... }

Members (7)

get · iOS 16.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The index of the first subview.

get · iOS 16.0+

layoutDirection

TypeScript
get layoutDirection(): LayoutDirection
Swift declaration
var layoutDirection: LayoutDirection

The layout direction inherited by the container view. SwiftUI supports both left-to-right and right-to-left directions. Read this property within a custom layout container to find out which environment the container is in. In most cases, you don't need to take any action based on this value. SwiftUI horizontally flips the x position of each view within its parent when the mode switches, so layout calculations automatically produce the desired effect for both directions.

set · iOS 16.0+

layoutDirection

TypeScript
set layoutDirection(value: LayoutDirection)
Swift declaration
var layoutDirection: LayoutDirection

The layout direction inherited by the container view. SwiftUI supports both left-to-right and right-to-left directions. Read this property within a custom layout container to find out which environment the container is in. In most cases, you don't need to take any action based on this value. SwiftUI horizontally flips the x position of each view within its parent when the mode switches, so layout calculations automatically produce the desired effect for both directions.

get · iOS 16.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

An index that's one higher than the last subview.

subscript · iOS 16.0+

subscript

TypeScript
subscript(index: number): LayoutSubview
Swift declaration
subscript(index: Int) -> LayoutSubviews.Element { get }

Gets the subview proxy at a specified index.

subscript · iOS 16.0+

subscript

TypeScript
subscript64883(bounds: SDKHandle): LayoutSubviews
Swift declaration
subscript(bounds: Range<Int>) -> LayoutSubviews { get }

Gets the subview proxies in the specified range.

subscript · iOS 16.0+

subscript

TypeScript
subscript55965(indices: Array<number>): LayoutSubviews
Swift declaration
subscript<S>(indices: S) -> LayoutSubviews where S : Sequence, S.Element == Int { get }

Gets the subview proxies with the specified indicies.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →