LayoutChain

public class LayoutChain

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

Accessor

  • 布局视图

    Declaration

    Swift

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

Lifecycle

  • 构造方法

    Declaration

    Swift

    public required init(view: UIView?)

Install

  • Undocumented

    Declaration

    Swift

    @discardableResult
    public func remake() -> Self

Compression

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

Collapse

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

Axis

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

Edge

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func top(_ inset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func bottom(_ inset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func left(_ inset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func right(_ inset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func top(toViewBottom view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func bottom(toViewTop view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func left(toViewRight view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func right(toViewLeft view: Any, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

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

SafeArea

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func top(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func bottom(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func left(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func right(toSafeArea inset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self

Dimension

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func width(toView view: Any, offset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    @discardableResult
    public func height(toView view: Any, offset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

Attribute

  • Undocumented

    Declaration

    Swift

    @discardableResult
    public func attribute(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, offset: CGFloat = 0) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    public func attribute(_ attribute: NSLayoutConstraint.Attribute, toAttribute: NSLayoutConstraint.Attribute, ofView view: Any?, offset: CGFloat, relation: NSLayoutConstraint.Relation) -> Self
  • Undocumented

    Declaration

    Swift

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

Offset

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

Constraint

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    public var constraint: NSLayoutConstraint? { get }
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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