UIView
class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate
-
Creates contraint to left anchor.
Declaration
Swift
@discardableResult public func anchorLeft(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to left anchor.
Declaration
Swift
@discardableResult public func anchorLeft(_ viewOrAnchor: NSLayoutXAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to right anchor.
Declaration
Swift
@discardableResult public func anchorRight(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to right anchor.
Declaration
Swift
@discardableResult public func anchorRight(_ viewOrAnchor: NSLayoutXAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to leading anchor.
Declaration
Swift
@discardableResult public func anchorLeading(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to leading anchor.
Declaration
Swift
@discardableResult public func anchorLeading(_ viewOrAnchor: NSLayoutXAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to trailing anchor.
Declaration
Swift
@discardableResult public func anchorTrailing(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to trailing anchor.
Declaration
Swift
@discardableResult public func anchorTrailing(_ viewOrAnchor: NSLayoutXAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to top anchor.
Declaration
Swift
@discardableResult public func anchorTop(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to top anchor.
Declaration
Swift
@discardableResult public func anchorTop(_ viewOrAnchor: NSLayoutYAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to bottom anchor.
Declaration
Swift
@discardableResult public func anchorBottom(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to bottom anchor.
Declaration
Swift
@discardableResult public func anchorBottom(_ viewOrAnchor: NSLayoutYAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to first baseline anchor.
Declaration
Swift
@discardableResult public func anchorFirstBaseline(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to first baseline anchor.
Declaration
Swift
@discardableResult public func anchorFirstBaseline(_ viewOrAnchor: NSLayoutYAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to last baseline anchor.
Declaration
Swift
@discardableResult public func anchorLastBaseline(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to last baseline anchor.
Declaration
Swift
@discardableResult public func anchorLastBaseline(_ viewOrAnchor: NSLayoutYAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to center Y anchor.
Declaration
Swift
@discardableResult public func anchorCenterY(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to center Y anchor.
Declaration
Swift
@discardableResult public func anchorCenterY(_ viewOrAnchor: NSLayoutYAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to center X anchor.
Declaration
Swift
@discardableResult public func anchorCenterX(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to center X anchor.
Declaration
Swift
@discardableResult public func anchorCenterX(_ viewOrAnchor: NSLayoutXAxisAnchor?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> NSLayoutConstraint?
-
Creates contraint to center anchor.
Declaration
Swift
@discardableResult public func anchorCenter(_ viewOrAnchor: UIView?) -> [NSLayoutConstraint]?
-
Creates contraint to leading, trailing, top, bottom edges anchor.
Declaration
Swift
@discardableResult public func anchorEdges(_ viewOrAnchor: UIView?, constant: LayoutRelation = LayoutRelation.default, activated: Bool = true, priority: UILayoutPriority = UILayoutPriority.required) -> [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 height, width anchor.
Declaration
Swift
@discardableResult public func anchorSize(_ relation: LayoutRelation = LayoutRelation.default, 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.
See morelet label = UILabel() ... ... // Creates guidelines set to be displayed let guidelines: UIView.Guideline = [.leading, .firstBaseline, .bottom] // Shows guideline on label label.showGuide(guideline: guidelines)
Declaration
Swift
public struct Guideline : OptionSet