LayoutElement
public protocol LayoutElement : AnyObject, LayoutCoordinateSpace, RectBasedElement
Protocol for any layout element
-
External representation of layout entity in coordinate space
Declaration
Swift
var frame: CGRect { get set }
-
Internal coordinate space of layout entity
Declaration
Swift
var bounds: CGRect { get set }
-
Internal space for layout subelements
Declaration
Swift
var layoutBounds: CGRect { get }
-
Layout element that maintains this layout entity
Declaration
Swift
var superElement: LayoutElement? { get }
-
Entity that represents element in layout time
Declaration
Swift
var inLayoutTime: ElementInLayoutTime { get }
-
Removes layout element from hierarchy
Declaration
Swift
func removeFromSuperElement()
-
layoutConstraint(for:)
Extension methodConvenience getter for constraint element related to this entity
Declaration
Swift
public func layoutConstraint(for anchors: [LayoutAnchor]) -> LayoutConstraint
Parameters
anchors
Array of anchor constraints
Return Value
Related constraint element
-
layoutBlock(with:constraints:)
Extension methodConvenience getter for layout block related to this entity
Declaration
Swift
public func layoutBlock(with layout: Layout = Layout.equal, constraints: [LayoutConstraintProtocol]) -> LayoutBlock<Self>
Parameters
layout
Main layout for this entity
constraints
Array of related constraint elements
Return Value
Related layout block
-
layoutBlock(with:)
Extension methodUndocumented
Declaration
Swift
public func layoutBlock(with layout: Layout = Layout.equal) -> LayoutBlock<Self>
-
contentLayoutConstraint(for:)
Extension methodConvenience getter for constraint that uses internal bounds to constrain, defined in ‘layoutBounds’ property
Declaration
Swift
public func contentLayoutConstraint(for anchors: [LayoutAnchor]) -> ContentLayoutConstraint
Parameters
anchors
Array of anchor constraints
Return Value
Related constraint element
-
layoutConstraint(for:debug:)
Extension methodUndocumented
Declaration
Swift
public func layoutConstraint(for anchors: [LayoutAnchor], debug: @escaping ((before: CGRect, after: CGRect), CGRect) -> Void) -> LayoutConstraint
-
baselineLayoutConstraint(for:)
Extension methodConvenience getter for constraint by baseline position
Declaration
Swift
func baselineLayoutConstraint(for anchors: [LayoutAnchor]) -> LayoutConstraint
Parameters
anchors
Array of anchor constraints
Return Value
Related constraint element