# SwappingContainerView

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

This container view is designed to hold two `UIView` elements and arrange them in a horizontal or vertical axis. It also allows to easily change the order of the views if needed.

- `Axis`

  Keys that specify a horizontal or vertical layout constraint between views.

  See more

  #### Declaration

  Swift

      public enum Axis : Hashable

- `Distribution`

  Keys that specify a distribution of the contained views.

  See more

  #### Declaration

  Swift

      public enum Distribution : Hashable

- `distribution`

  The layout of the arranged subviews along the axis.

  #### Declaration

  Swift

      public var distribution: Distribution { get set }

- `axis`

  The distribution axis of the contained view.

  #### Declaration

  Swift

      public var axis: Axis { get set }

- `spacing`

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

  #### Declaration

  Swift

      public var spacing: CGFloat { get set }

- `preferredPriority`

  Preferred priority of the internal constraints.

  #### Declaration

  Swift

      public var preferredPriority: UILayoutPriority { get set }

- `accessoryView`

  Contained accessory view.

  #### Declaration

  Swift

      public var accessoryView: AccessoryView { get set }

- `customView`

  Contained main view.

  #### Declaration

  Swift

      public var customView: CustomView { get set }

- `init(frame:axis:distribution:spacing:preferredPriority:)`

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

  #### Declaration

  Swift

      public init(frame: CGRect,
                  axis: Axis = .horizontal,
                  distribution: Distribution = .accessoryFirst,
                  spacing: CGFloat,
                  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. to the superview in which you plan to add it.

- `init(frame:)`

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

  #### Declaration

  Swift

      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.

- `requiresConstraintBasedLayout`

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

  #### Declaration

  Swift

      public override class var requiresConstraintBasedLayout: Bool { get }

- `updateConstraints()`

  Updates constraints for the view.

  #### Declaration

  Swift

      public override func updateConstraints()