Functions
The following functions are available globally.
-
Declares a property equal to a numerical constant.
Declaration
Swift
@discardableResult public func == (lhs: NumericalEquality, rhs: CGFloat) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe numerical constant.
Return Value
An
NSLayoutConstraint. -
Declares a property equal to a the result of an expression.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeEquality>(lhs: P, rhs: Expression<P>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe expression.
Return Value
An
NSLayoutConstraint. -
Declares a property equal to another property.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeEquality>(lhs: P, rhs: P) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
-
Declares a property less than or equal to a numerical constant.
Declaration
Swift
@discardableResult public func <= (lhs: NumericalInequality, rhs: CGFloat) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe numerical constant.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to a numerical constant.
Declaration
Swift
@discardableResult public func >= (lhs: NumericalInequality, rhs: CGFloat) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe numerical constant.
Return Value
An
NSLayoutConstraint. -
Declares a property less than or equal to another property.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeInequality>(lhs: P, rhs: P) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to another property.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeInequality>(lhs: P, rhs: P) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property less than or equal to the result of an expression.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeInequality>(lhs: P, rhs: Expression<P>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to the result of an expression.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeInequality>(lhs: P, rhs: Expression<P>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint.
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Sets the priority for a constraint.
Declaration
Swift
@discardableResult public func ~ (lhs: NSLayoutConstraint, rhs: LayoutPriority) -> NSLayoutConstraintParameters
lhsThe constraint to update.
rhsThe new priority.
Return Value
The same constraint with its priority updated.
-
Sets the priority for multiple constraints.
Declaration
Swift
@discardableResult public func ~ (lhs: [NSLayoutConstraint], rhs: LayoutPriority) -> [NSLayoutConstraint]Parameters
lhsAn array of
NSLayoutConstraintinstances.rhsThe new priority.
Return Value
The same constraints with their priorities updated.
-
Insets all edges.
Declaration
Swift
public func inset(_ edges: Edges, _ all: CGFloat) -> Expression<Edges>Parameters
edgesThe edges to inset.
allThe amount by which to inset all edges, in points.
Return Value
A new expression with the inset edges.
-
Insets the horizontal and vertical edges.
Declaration
Swift
public func inset(_ edges: Edges, _ horizontal: CGFloat, _ vertical: CGFloat) -> Expression<Edges>Parameters
edgesThe edges to inset.
horizontalThe amount by which to inset the horizontal edges, in points.
verticalThe amount by which to inset the vertical edges, in points.
Return Value
A new expression with the inset edges.
-
Insets edges individually.
Declaration
Swift
public func inset(_ edges: Edges, _ top: CGFloat, _ leading: CGFloat, _ bottom: CGFloat, _ trailing: CGFloat) -> Expression<Edges>Parameters
edgesThe edges to inset.
topThe amount by which to inset the top edge, in points.
leadingThe amount by which to inset the leading edge, in points.
bottomThe amount by which to inset the bottom edge, in points.
trailingThe amount by which to inset the trailing edge, in points.
Return Value
A new expression with the inset edges.
-
Insets edges individually with UIEdgeInset.
Declaration
Swift
public func inset(_ edges: Edges, _ insets: UIEdgeInsets) -> Expression<Edges>Parameters
edgesThe edges to inset.
insetsThe amounts by which to inset all edges, in points via UIEdgeInsets.
Return Value
A new expression with the inset edges.
-
Updates the constraints of a single view.
Declaration
Swift
@discardableResult public func constrain(_ view: View, replace group: ConstraintGroup? = nil, block: (LayoutProxy) -> ()) -> ConstraintGroupParameters
viewThe view to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for
view. -
Updates the constraints of two views.
Declaration
Swift
@discardableResult public func constrain(_ view1: View, _ view2: View, replace group: ConstraintGroup? = nil, block: (LayoutProxy, LayoutProxy) -> ()) -> ConstraintGroupParameters
view1A view to layout.
view2A view to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for the views.
-
Updates the constraints of three views.
Declaration
Swift
@discardableResult public func constrain(_ view1: View, _ view2: View, _ view3: View, replace group: ConstraintGroup? = nil, block: (LayoutProxy, LayoutProxy, LayoutProxy) -> ()) -> ConstraintGroupParameters
view1A view to layout.
view2A view to layout.
view3A view to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for the views.
-
Updates the constraints of four views.
Declaration
Swift
@discardableResult public func constrain(_ view1: View, _ view2: View, _ view3: View, _ view4: View, replace group: ConstraintGroup? = nil, block: (LayoutProxy, LayoutProxy, LayoutProxy, LayoutProxy) -> ()) -> ConstraintGroupParameters
view1A view to layout.
view2A view to layout.
view3A view to layout.
view4A view to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for the views.
-
Updates the constraints of five views.
Declaration
Swift
@discardableResult public func constrain(_ view1: View, _ view2: View, _ view3: View, _ view4: View, _ view5: View, replace group: ConstraintGroup? = nil, block: (LayoutProxy, LayoutProxy, LayoutProxy, LayoutProxy, LayoutProxy) -> ()) -> ConstraintGroupParameters
view1A view to layout.
view2A view to layout.
view3A view to layout.
view4A view to layout.
view5A view to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for the views.
-
Updates the constraints of an array of views.
Declaration
Swift
@discardableResult public func constrain(_ views: [View], replace group: ConstraintGroup? = nil, block: ([LayoutProxy]) -> ()) -> ConstraintGroupParameters
viewsThe views to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for
views. -
Updates the constraints of a dictionary of views.
Declaration
Swift
@discardableResult public func constrain<T: Hashable>(_ views: [T: View], replace group: ConstraintGroup? = nil, block: (([T : LayoutProxy]) -> ())) -> ConstraintGroupParameters
viewsThe views to layout.
replaceThe
ConstraintGroupwhose constraints should be replaced.blockA block that declares the layout for
views. -
Removes all constraints for a group.
Declaration
Swift
@discardableResult public func constrain(clear group: ConstraintGroup)Parameters
clearThe
ConstraintGroupwhose constraints should be removed.
-
Distributes multiple views horizontally.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, horizontally views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsAn array of views to distribute.
Return Value
An array of
NSLayoutConstraintinstances. -
Distributes multiple views horizontally from left to right.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, leftToRight views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsAn array of views to distribute.
Return Value
An array of
NSLayoutConstraintinstances. -
Distributes multiple views vertically.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, vertically views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsAn array of views to distribute.
Return Value
An array of
NSLayoutConstraintinstances. -
Distributes multiple views horizontally.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, horizontally first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsThe views to distribute.
Return Value
An array of
NSLayoutConstraintinstances. -
Distributes multiple views horizontally from left to right.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, leftToRight first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsThe views to distribute.
Return Value
An array of
NSLayoutConstraintinstances. -
Distributes multiple views vertically.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func distribute(by amount: CGFloat = 0.0, vertically first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Parameters
amountThe distance between the views.
viewsThe views to distribute.
Return Value
An array of
NSLayoutConstraintinstances.
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Declares a property equal to a the result of an expression.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeCompoundEquality>(lhs: P, rhs: Expression<P>) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe expression.
Return Value
An
NSLayoutConstraint. -
Declares a property equal to another compound property.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeCompoundEquality>(lhs: P, rhs: P) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
-
Declares a property less than or equal to another compound property.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeCompoundInequality>(lhs: P, rhs: P) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to another compound property.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeCompoundInequality>(lhs: P, rhs: P) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property less than or equal to the result of an expression.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeCompoundInequality>(lhs: P, rhs: Expression<P>) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to the result of an expression.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeCompoundInequality>(lhs: P, rhs: Expression<P>) -> [NSLayoutConstraint]Parameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe other property.
Return Value
An
NSLayoutConstraint. -
Declares a property equal to a layout support.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeEquality>(lhs: P, rhs: LayoutSupport) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support.
Return Value
An
NSLayoutConstraint. -
Declares a property equal to the result of a layout support expression.
See moreDeclaration
Swift
@discardableResult public func == <P: RelativeEquality>(lhs: P, rhs: Expression<LayoutSupport>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support expression.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to a layout support.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeEquality>(lhs: P, rhs: LayoutSupport) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support.
Return Value
An
NSLayoutConstraint. -
Declares a property less than or equal to a layout support.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeEquality>(lhs: P, rhs: LayoutSupport) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support.
Return Value
An
NSLayoutConstraint. -
Declares a property greater than or equal to the result of a layout support expression.
See moreDeclaration
Swift
@discardableResult public func >= <P: RelativeEquality>(lhs: P, rhs: Expression<LayoutSupport>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support.
Return Value
An
NSLayoutConstraint. -
Declares a property less than or equal to the result of a layout support expression.
See moreDeclaration
Swift
@discardableResult public func <= <P: RelativeEquality>(lhs: P, rhs: Expression<LayoutSupport>) -> NSLayoutConstraintParameters
lhsThe affected property. The associated view will have
translatesAutoresizingMaskIntoConstraintsset tofalse.rhsThe layout support.
Return Value
An
NSLayoutConstraint.
-
Aligns multiple views by their top edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(top views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their right edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(right views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their bottom edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(bottom views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their left edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(left views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their leading edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(leading views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their trailing edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(trailing views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their horizontal center.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(centerX views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their vertical center.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(centerY views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their baseline.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(baseline views: [LayoutProxy]) -> [NSLayoutConstraint]Parameters
viewsan array of views to align
Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their top edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(top first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their right edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(right first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their bottom edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(bottom first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their left edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(left first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their leading edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(leading first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple vies by their trailing edge.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(trailing first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their horizontal center.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(centerX first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their vertical center.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(centerY first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances. -
Aligns multiple views by their baseline.
All views passed to this function will have their
translatesAutoresizingMaskIntoConstraintsproperties set tofalse.Declaration
Swift
@discardableResult public func align(baseline first: LayoutProxy, _ rest: LayoutProxy...) -> [NSLayoutConstraint]Return Value
An array of
NSLayoutConstraintinstances.
View on GitHub
Functions Reference