Constrainable
public protocol Constrainable
Constrainable is an abstraction of Apple layout anchor system
-
A layout anchor abstraction representing the top edge of the view or layout guide frame.
Declaration
Swift
var topAnchor: NSLayoutYAxisAnchor { get } -
A layout anchor abstraction representing the bottom edge of the view or layout guide frame.
Declaration
Swift
var bottomAnchor: NSLayoutYAxisAnchor { get } -
A layout anchor abstraction representing the leading edge of the view or layout guide frame.
Declaration
Swift
var leadingAnchor: NSLayoutXAxisAnchor { get } -
A layout anchor abstraction representing the left edge of the view or layout guide frame.
Declaration
Swift
var leftAnchor: NSLayoutXAxisAnchor { get } -
A layout anchor abstraction representing the trailing edge of the view or layout guide frame.
Declaration
Swift
var trailingAnchor: NSLayoutXAxisAnchor { get } -
A layout anchor abstraction representing the right edge of the view or layout guide frame.
Declaration
Swift
var rightAnchor: NSLayoutXAxisAnchor { get } -
A layout anchor abstraction representing the height of the view or layout guide frame.
Declaration
Swift
var heightAnchor: NSLayoutDimension { get } -
A layout anchor abstraction representing the width of the view or layout guide frame.
Declaration
Swift
var widthAnchor: NSLayoutDimension { get } -
A layout anchor abstraction representing the horizontal center of the view or layout guide frame.
Declaration
Swift
var centerXAnchor: NSLayoutXAxisAnchor { get } -
A layout anchor abstraction representing the vertical center of the view or layout guide frame.
Declaration
Swift
var centerYAnchor: NSLayoutYAxisAnchor { get } -
topAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the top edge of the view’s frame.
Declaration
Swift
@discardableResult func topAnchor(equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
topAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the top edge of the view’s frame.
Declaration
Swift
@discardableResult func topAnchor(greaterThanOrEqualTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
topAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the top edge of the view’s frame.
Declaration
Swift
@discardableResult func topAnchor(lessThanOrEqualTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
bottomAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the bottom edge of the view’s frame.
Declaration
Swift
@discardableResult func bottomAnchor(equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
bottomAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the bottom edge of the view’s frame.
Declaration
Swift
@discardableResult func bottomAnchor(greaterThanOrEqualTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
bottomAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the bottom edge of the view’s frame.
Declaration
Swift
@discardableResult func bottomAnchor(lessThanOrEqualTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leadingAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the leading edge of the view’s frame.
Declaration
Swift
@discardableResult func leadingAnchor(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leadingAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the leading edge of the view’s frame.
Declaration
Swift
@discardableResult func leadingAnchor(greaterThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leadingAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the leading edge of the view’s frame.
Declaration
Swift
@discardableResult func leadingAnchor(lessThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leftAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the left edge of the view’s frame.
Declaration
Swift
@discardableResult func leftAnchor(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leftAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the left edge of the view’s frame.
Declaration
Swift
@discardableResult func leftAnchor(greaterThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
leftAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the left edge of the view’s frame.
Declaration
Swift
@discardableResult func leftAnchor(lessThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
trailingAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the trailing edge of the view’s frame.
Declaration
Swift
@discardableResult func trailingAnchor(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
trailingAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the trailing edge of the view’s frame.
Declaration
Swift
@discardableResult func trailingAnchor(greaterThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
trailingAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the trailing edge of the view’s frame.
Declaration
Swift
@discardableResult func trailingAnchor(lessThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
rightAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the right edge of the view’s frame.
Declaration
Swift
@discardableResult func rightAnchor(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
rightAnchor(greaterThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the right edge of the view’s frame.
Declaration
Swift
@discardableResult func rightAnchor(greaterThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
rightAnchor(lessThanOrEqualTo:Extension methodconstant: priority: ) A layout anchor representing the right edge of the view’s frame.
Declaration
Swift
@discardableResult func rightAnchor(lessThanOrEqualTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToVertical layout constraint.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(equalToConstant:Extension methodpriority: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(equalToConstant height: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(greaterThanOrEqualToConstant:Extension methodpriority: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(greaterThanOrEqualToConstant height: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(lessThanOrEqualToConstant:Extension methodpriority: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(lessThanOrEqualToConstant height: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(equalTo:Extension methodpriority: multiplier: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(equalTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
equalToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(lessThanOrEqualTo:Extension methodpriority: multiplier: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(lessThanOrEqualTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
lessThanOrEqualToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
heightAnchor(greaterThanOrEqualTo:Extension methodpriority: multiplier: ) A layout anchor representing the height of the view’s frame.
Declaration
Swift
@discardableResult func heightAnchor(greaterThanOrEqualTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
greaterThanOrEqualToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(equalToConstant:Extension methodpriority: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(equalToConstant width: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(greaterThanOrEqualToConstant:Extension methodpriority: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(greaterThanOrEqualToConstant width: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
greaterThanOrEqualToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(lessThanOrEqualToConstant:Extension methodpriority: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(lessThanOrEqualToConstant width: CGFloat, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
lessThanOrEqualToConstantA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(equalTo:Extension methodpriority: multiplier: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(equalTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
equalToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(lessThanOrEqualTo:Extension methodpriority: multiplier: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(lessThanOrEqualTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
lessThanOrEqualToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
widthAnchor(greaterThanOrEqualTo:Extension methodpriority: multiplier: ) A layout anchor representing the width of the view’s frame.
Declaration
Swift
@discardableResult func widthAnchor(greaterThanOrEqualTo layoutDimension: NSLayoutDimension, priority: LayoutPriority = .required, multiplier: CGFloat = 1.0) -> NSLayoutConstraintParameters
greaterThanOrEqualToA constant representing the size of the attribute associated with this dimension anchor.
priorityLayout priority used to indicate the constraint-based layout system.
multiplierThe multiplier constant for the constraint.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
centerXAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the horizontal center of the view’s frame.
Declaration
Swift
@discardableResult func centerXAnchor(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToA constant representing the size of the attribute associated with this dimension anchor.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
centerYAnchor(equalTo:Extension methodconstant: priority: ) A layout anchor representing the vertical center of the view’s frame.
Declaration
Swift
@discardableResult func centerYAnchor(equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, priority: LayoutPriority = .required) -> NSLayoutConstraintParameters
equalToA constant representing the size of the attribute associated with this dimension anchor.
constantThe constant offset for the constraint.
priorityLayout priority used to indicate the constraint-based layout system.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
-
inset(to:Extension methodwithInset: ) A layout anchor to set inset distances for views.
Declaration
Swift
@discardableResult func inset(to view: View, withInset inset: EdgeInsets? = nil) -> [NSLayoutConstraint]Parameters
toThe target View to apply the edge insets.
withInsetAdjusts a rectangle by the given edge insets.
Return Value
All the activated and applied constraints to the current View with
-
aspectRatio(constant:Extension method) A layout anchor representing the aspect ratio of a View.
Declaration
Swift
@discardableResult func aspectRatio(constant: CGFloat) -> NSLayoutConstraintParameters
constantA constant representing the value of the aspect ratio to be applied.
Return Value
An activated NSLayoutConstraint object that defines a constant size for the attribute associated with this dimension anchor.
View on GitHub
Constrainable Protocol Reference