UIView

class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate

These are useful UIView extensions that we use to get the current first responder, and add dynamically-constructed auto layout views.

  • This allows us to add a subview, and set it up with auto-layout constraints to fill the superview.

    Declaration

    Swift

    func addContainedView(_ inSubView: UIView)

    Parameters

    inSubview

    The subview we want to add.

  • Declaration

    Swift

    var currentFirstResponder: UIResponder! { get }

    Return Value

    the first responder view. Nil, if no view is a first responder.