Contents

splitArrangementFixedLayoutSize(horizontal:vertical:)

Sets the preferred size constraint for a view in a split arrangement style to the ideal size of the view within its container.

Declaration

nonisolated func splitArrangementFixedLayoutSize(horizontal: Bool = true, vertical: Bool = true) -> some View

Parameters

  • horizontal:

    A Boolean value that indicates whether to prefer a fixed width for the view in a horizontal split.

  • vertical:

    A Boolean value that indicates whether to prefer a fixed height for the view in a vertical split.

Discussion

Add this modifier to a view in a split style ArrangementView, and specify true when you want the system to limit the view’s size to the ideal size for that axis, as the following example shows:

ArrangementView {
    ChartView()
        .splitArrangementFixedLayoutSize(horizontal: true, vertical: false)
} secondary: {
    NewsView()
}
.arrangementViewStyle(.split)

Note that the arrangement view may resize the view to a smaller size depending on the view’s priority.

See Also

Dynamically arranging a primary and secondary view