Contents

splitArrangementLayoutRatio(_:)

Sets the preferred size ratio for a view in a split style arrangement view.

Declaration

nonisolated func splitArrangementLayoutRatio(_ ratio: CGFloat?) -> some View

Parameters

  • ratio:

    A float value between zero and one that indicates the ratio the view uses for its preferred size.

Discussion

Use this modifier when you want to customize the size of the view compared to the other view in the split layout, as the following example shows:

ArrangementView {
    ConversationView()
        .splitArrangementLayoutRatio(0.3)
} secondary: {
    PhotosView()
}
.arrangementViewStyle(.split.axes(.horizontal))

The arrangement sizes the view with the highest layoutPriority using its ratio. When a view has a ratio that would be greater than the remaining size of the arrangement view container, the arrangement uses the remaining size instead. When a view’s ratio prevents filling the container’s total size with both views, the arrangement increases the size of the highest priority view.

See Also

Dynamically arranging a primary and secondary view