UIView

class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate
  • Creates contraint to center anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorCenter(_ viewOrAnchor: UIView?) -> [NSLayoutConstraint]?
  • Creates contraint to height anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorHeight(_ relation: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
  • Creates contraint to height anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorHeight(_ viewOrAnchor: UIView?, multiplier: CGFloat = 1.0, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
  • Creates contraint to height anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorHeight(_ viewOrAnchor: NSLayoutDimension?, multiplier: CGFloat = 1.0, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
  • Creates contraint to width anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorWidth(_ relation: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint
  • Creates contraint to width anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorWidth(_ viewOrAnchor: UIView?, multiplier: CGFloat = 1.0, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
  • Creates contraint to width anchor.

    Declaration

    Swift

    @discardableResult
    public func anchorWidth(_ viewOrAnchor: NSLayoutDimension?, multiplier: CGFloat = 1.0, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
  • Creates contraint to icon size.

    Declaration

    Swift

    @discardableResult
    public func anchorIcon(_ iconSize: IconSize, activated: Bool = true) -> [NSLayoutConstraint]?
  • Add recursive border to view and all its subviews

    This method is part of UI debug helper tools.

    Declaration

    Swift

    public static func recursiveEnableBorder(_ view: UIView, color: UIColor = UIColor.black, width: CGFloat = 1.0)

    Parameters

    view

    target view in which borders will be enabled.

    color

    Color for border, by default ‘black’ color.

    width

    width of border, by default 1.0.

  • Shows guide for an instance of view, Guideline adds single line view with constraints equivalents to edges, dimentions, baselines.

    Guideline is part of UI debug helper tools. Example usage can be as below, as it adds lines using autolayouts it is expected target view should be added to its superview.

    let label = UILabel()
    ...
    ...
    // Creates guidelines set to be displayed
    let guidelines: UIView.Guideline = [.leading, .firstBaseline, .bottom]
    
    // Shows guideline on label
    label.showGuide(guideline: guidelines)
    
    See more

    Declaration

    Swift

    public struct Guideline : OptionSet
  • Show guide for view with guideline options

    Declaration

    Swift

    public func showGuide(guideline: Guideline = Guideline.basic, color: UIColor = UIColor.black)

    Parameters

    guideline

    Guidelines to be displayed. By default options [.top, .bottom, .leading]

    color

    Color for guideline