LayoutChain

@MainActor
public class LayoutChain

视图链式布局类。如果约束条件完全相同,会自动更新约束而不是重新添加。 另外,默认布局方式使用LTR,如果需要RTL布局,可通过autoLayoutRTL统一启用

Accessor

  • 布局视图

    Declaration

    Swift

    @MainActor
    public private(set) weak var view: UIView? { get }

Lifecycle

  • 构造方法

    Declaration

    Swift

    @MainActor
    public required init(view: UIView?)

Install

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func remake() -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func autoScale(_ autoScale: Bool) -> Self

Compression

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func compression(horizontal priority: UILayoutPriority) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func compression(vertical priority: UILayoutPriority) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func hugging(horizontal priority: UILayoutPriority) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func hugging(vertical priority: UILayoutPriority) -> Self

Collapse

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func isCollapsed(_ isCollapsed: Bool) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func autoCollapse(_ autoCollapse: Bool) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func autoMatchDimension(_ matchDimension: Bool) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func hiddenCollapse(_ hiddenCollapse: Bool) -> Self

Axis

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func center(_ offset: CGPoint = .zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerX(_ offset: CGFloat = .zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerY(_ offset: CGFloat = .zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func center(toView view: Any) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerX(toView view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerY(toView view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerX(toView view: Any, multiplier: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerY(toView view: Any, multiplier: CGFloat) -> Self

Edge

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func edges(_ insets: UIEdgeInsets = UIEdgeInsets.zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func edges(_ insets: UIEdgeInsets = UIEdgeInsets.zero, excludingEdge edge: NSLayoutConstraint.Attribute) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func horizontal(_ inset: CGFloat = .zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func vertical(_ inset: CGFloat = .zero) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func top(_ inset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func bottom(_ inset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func left(_ inset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func right(_ inset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func top(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func bottom(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func left(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func right(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func horizontal(toView view: Any) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func vertical(toView view: Any) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func top(toViewBottom view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func bottom(toViewTop view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func left(toViewRight view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func right(toViewLeft view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self

SafeArea

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func center(toSafeArea offset: CGPoint) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerX(toSafeArea offset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func centerY(toSafeArea offset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func edges(toSafeArea insets: UIEdgeInsets) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func edges(toSafeArea insets: UIEdgeInsets, excludingEdge edge: NSLayoutConstraint.Attribute) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func horizontal(toSafeArea inset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func vertical(toSafeArea inset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func top(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func bottom(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func left(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func right(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self

Dimension

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func size(_ size: CGSize) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func size(width: CGFloat, height: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func width(_ width: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func height(_ height: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func width(toHeight multiplier: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func height(toWidth multiplier: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func size(toView view: Any) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func width(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func height(toView view: Any, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func width(toView view: Any, multiplier: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func height(toView view: Any, multiplier: CGFloat, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self

Attribute

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func attribute(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, offset: CGFloat = 0, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func attribute(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, multiplier: CGFloat, offset: CGFloat = .zero, relation: NSLayoutConstraint.Relation = .equal, priority: UILayoutPriority = .required) -> Self

Subviews

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func subviews(_ closure: (_ make: LayoutChain) -> Void) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func subviews(along axis: NSLayoutConstraint.Axis, itemSpacing: CGFloat, leadSpacing: CGFloat? = nil, tailSpacing: CGFloat? = nil, itemLength: CGFloat? = nil, equalLength: Bool = false) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func subviews(along axis: NSLayoutConstraint.Axis, itemLength: CGFloat, leadSpacing: CGFloat, tailSpacing: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func subviews(along axis: NSLayoutConstraint.Axis, alignCenter: Bool = false, itemWidth: CGFloat? = nil, leftSpacing: CGFloat? = nil, rightSpacing: CGFloat? = nil) -> Self

Offset

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func relative() -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func fixed() -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func offset(_ offset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func constant(_ constant: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func priority(_ priority: UILayoutPriority) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func collapse(_ offset: CGFloat? = nil) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func original(_ offset: CGFloat) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func collapseActive(_ active: Bool? = nil) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func collapsePriority(_ priority: UILayoutPriority? = nil) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func originalPriority(_ priority: UILayoutPriority) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func identifier(_ identifier: String?) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func active(_ active: Bool) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func remove() -> Self

Constraint

  • Undocumented

    Declaration

    Swift

    @MainActor
    public var constraints: [NSLayoutConstraint] { get }
  • Undocumented

    Declaration

    Swift

    @MainActor
    public var constraint: NSLayoutConstraint? { get }
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func constraint(_ attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal) -> NSLayoutConstraint?
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func constraint(toSafeArea attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal) -> NSLayoutConstraint?
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func constraint(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal) -> NSLayoutConstraint?
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func constraint(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, multiplier: CGFloat, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal) -> NSLayoutConstraint?
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func constraint(identifier: String?) -> NSLayoutConstraint?

Debug

  • Undocumented

    Declaration

    Swift

    @discardableResult
    @MainActor
    public func layoutKey(_ layoutKey: String?) -> Self