AnonymConstraint

public struct AnonymConstraint : LayoutConstraintProtocol

Layout constraint for independent changing source space. Use him with anchors that not describes rect side (for example LayoutAnchor.insets or LayoutAnchor.Size).

  • Undocumented

    Declaration

    Swift

    public init(anchors: [RectBasedConstraint], constrainRect: ((CGRect) -> CGRect)? = nil)
  • Flag, defines that constraint may be used for layout

    Declaration

    Swift

    public var isActive: Bool { get }
  • Flag that constraint not required other calculations. It`s true for size-based constraints.

    Declaration

    Swift

    public var isIndependent: Bool { get }
  • LayoutElement object associated with this constraint

    Declaration

    Swift

    public func layoutElement(is object: AnyObject) -> Bool
  • Return rectangle for constrain source rect

    Declaration

    Swift

    public func constrainRect(for currentSpace: CGRect, in coordinateSpace: LayoutElement) -> CGRect

    Parameters

    currentSpace

    Source rect in current state

    coordinateSpace

    Working coordinate space

    Return Value

    Rect for constrain

  • Main function for constrain source space by other rect

    Declaration

    Swift

    public func formConstrain(sourceRect: inout CGRect, by rect: CGRect)

    Parameters

    sourceRect

    Source space

    rect

    Rect for constrain

  • Converts rect from constraint coordinate space to destination coordinate space if needed.

    Declaration

    Swift

    public func convert(rectIfNeeded rect: CGRect, to coordinateSpace: LayoutElement) -> CGRect

    Parameters

    rect

    Initial rect

    coordinateSpace

    Destination coordinate space

    Return Value

    Converted rect

Additional constraints