SwappingContainerView

@MainActor
public final class SwappingContainerView<CustomView, AccessoryView> : UIView where CustomView : UIView, AccessoryView : UIView

A container that arranges two views along a horizontal or vertical axis.

Hiding either view makes the other fill the arrangement axis.

  • The axis along which the contained views are arranged.

    See more

    Declaration

    Swift

    public enum Axis : Hashable
  • The order of the contained views along the arrangement axis.

    See more

    Declaration

    Swift

    public enum Distribution : Hashable
  • The order of the arranged subviews.

    Declaration

    Swift

    @MainActor
    public var distribution: Distribution { get set }
  • The axis along which the contained views are arranged.

    Declaration

    Swift

    @MainActor
    public var axis: Axis { get set }
  • The distance in points between the edges of the contained views.

    Declaration

    Swift

    @MainActor
    public var spacing: CGFloat { get set }
  • Preferred priority of the internal constraints.

    Declaration

    Swift

    @MainActor
    public var preferredPriority: UILayoutPriority { get set }
  • Contained accessory view.

    Declaration

    Swift

    @MainActor
    public var accessoryView: AccessoryView { get set }
  • Contained main view.

    Declaration

    Swift

    @MainActor
    public var customView: CustomView { get set }
  • Initializes and returns a newly allocated view object with the specified frame rectangle.

    Declaration

    Swift

    @MainActor
    public init(
        frame: CGRect,
        axis: Axis = .horizontal,
        distribution: Distribution = .accessoryFirst,
        spacing: CGFloat = .zero,
        preferredPriority: UILayoutPriority = .required
    )

    Parameters

    frame

    The frame rectangle for the view, measured in points. The origin of the frame is relative

    axis

    The view distribution axis.

    distribution

    The layout of the arranged subviews along the axis.

    spacing

    The distance in points between the edges of the contained views.

    preferredPriority

    Preferred priority of the internal constraints.

  • Initializes and returns a newly allocated container with the provided views.

    Declaration

    Swift

    @MainActor
    public init(
        with customView: CustomView,
        accessoryView: AccessoryView,
        axis: Axis = .horizontal,
        distribution: Distribution = .accessoryFirst,
        spacing: CGFloat = .zero,
        preferredPriority: UILayoutPriority = .required
    )

    Parameters

    customView

    The main view.

    accessoryView

    The accessory view.

    axis

    The view distribution axis.

    distribution

    The layout of the contained views along the axis.

    spacing

    The distance in points between the edges of the contained views.

    preferredPriority

    Preferred priority of the internal constraints.

  • Initializes and returns a newly allocated view object with the specified frame rectangle.

    Declaration

    Swift

    @MainActor
    public override init(frame: CGRect)

    Parameters

    frame

    The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it.

  • A Boolean value that indicates whether the receiver depends on the constraint-based layout system.

    Declaration

    Swift

    @MainActor
    public override class var requiresConstraintBasedLayout: Bool { get }
  • Updates constraints for the view.

    Declaration

    Swift

    @MainActor
    public override func updateConstraints()