NSLayoutConstraint

class NSLayoutConstraint : NSObject
  • NSLayoutConstraint with default values to reduce init function length in most cases

    Declaration

    Swift

    internal convenience init(item view1: Any,
                              attribute attr1: NSLayoutConstraint.Attribute,
                              relatedBy relation: NSLayoutConstraint.Relation,
                              toItem view2: Any?,
                              attribute attr2: NSLayoutConstraint.Attribute?,
                              multiplier: CGFloat = 1.0,
                              constant c: CGFloat = 0.0)

    Parameters

    view1

    Any

    attr1

    NSLayoutConstraint.Attribute

    relation

    CGFloat

    view2

    Any? Will be view1 if nil

    attr2

    NSLayoutConstraint.Attribute? Will be attr1 if nil

    multiplier

    CGFloat Will be 1.0 if missing

    c

    CGFloat Will be 0.0 if missing

    Return Value

    NSLayoutConstraint

  • Change the multiplier variable of a specific constraint

    Declaration

    Swift

    public static func change(multiplier: CGFloat, for constraint: NSLayoutConstraint) -> NSLayoutConstraint

    Parameters

    multiplier

    The new multiplier value.

    constraint

    The constraint to change.

    Return Value

    The new constraint if possible.