Contents

init(in:content:)

Produces a view constrained in the given axes from one of several alternatives provided by a content builder.

Declaration

nonisolated init(in axes: Axis.Set = [.horizontal, .vertical], @ContentBuilder content: () -> Content)

Parameters

  • axes:

    A set of axes to constrain children to. The set may contain Horizontal, Vertical, or both of these. ViewThatFits chooses the first child whose size fits within the proposed size on these axes. If axes is an empty set, ViewThatFits uses the first child view. By default, ViewThatFits uses both axes.

  • content:

    A content builder that provides the child views for this container, in order of preference. The builder chooses the first child view that fits within the proposed width, height, or both, as defined by axes.