Skip to content

Commit

Permalink
Use to: argument label
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller committed Feb 20, 2024
1 parent 2a2d4c6 commit e3ef096
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions Sources/Layout/Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ public final class Layout { // swiftlint:disable:this type_body_length
let guide: UILayoutGuide = .init()
layoutView.addLayoutGuide(guide)
return adding([
guide.leading.constraint(equalTo: leading),
guide.trailing.constraint(equalTo: trailing),
view.centerX.constraint(equalTo: guide.centerX).withPriority(priority)
guide.leading.constraint(to: leading),
guide.trailing.constraint(to: trailing),
view.centerX.constraint(to: guide.centerX).withPriority(priority)
])
}

Expand Down Expand Up @@ -555,9 +555,9 @@ public final class Layout { // swiftlint:disable:this type_body_length
let guide: UILayoutGuide = .init()
layoutView.addLayoutGuide(guide)
return adding([
guide.top.constraint(equalTo: top),
guide.bottom.constraint(equalTo: bottom),
view.centerY.constraint(equalTo: guide.centerY).withPriority(priority)
guide.top.constraint(to: top),
guide.bottom.constraint(to: bottom),
view.centerY.constraint(to: guide.centerY).withPriority(priority)
])
}

Expand Down Expand Up @@ -593,21 +593,21 @@ public final class Layout { // swiftlint:disable:this type_body_length
case .leadingToTrailing:
var anchor: NSLayoutXAxisAnchor = first.trailing
for view in views.dropFirst() {
adding(view.leading.constraint(equalTo: anchor, constant: spacing).withPriority(priority))
adding(view.leading.constraint(to: anchor, constant: spacing).withPriority(priority))
anchor = view.trailing
}
case .leftToRight:
var anchor: NSLayoutXAxisAnchor = first.right
for view in views.dropFirst() {
adding(view.left.constraint(equalTo: anchor, constant: spacing).withPriority(priority))
adding(view.left.constraint(to: anchor, constant: spacing).withPriority(priority))
anchor = view.right
}
}
for attribute: YAxisAttribute in alignment {
let firstAnchor: NSLayoutYAxisAnchor = first.anchor(for: attribute)
let constraints: [NSLayoutConstraint] = views
.dropFirst()
.map { $0.anchor(for: attribute).constraint(equalTo: firstAnchor) }
.map { $0.anchor(for: attribute).constraint(to: firstAnchor) }
adding(constraints.withPriority(priority))
}
return self
Expand Down Expand Up @@ -637,14 +637,14 @@ public final class Layout { // swiftlint:disable:this type_body_length
else { return self }
var anchor: NSLayoutYAxisAnchor = first.bottom
for view in views.dropFirst() {
adding(view.top.constraint(equalTo: anchor, constant: spacing).withPriority(priority))
adding(view.top.constraint(to: anchor, constant: spacing).withPriority(priority))
anchor = view.bottom
}
for attribute: XAxisAttribute in alignment {
let firstAnchor: NSLayoutXAxisAnchor = first.anchor(for: attribute)
let constraints: [NSLayoutConstraint] = views
.dropFirst()
.map { $0.anchor(for: attribute).constraint(equalTo: firstAnchor) }
.map { $0.anchor(for: attribute).constraint(to: firstAnchor) }
adding(constraints.withPriority(priority))
}
return self
Expand Down
16 changes: 8 additions & 8 deletions Sources/Layout/LayoutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -804,22 +804,22 @@ extension LayoutItem {
case .top:
return layoutItemView
.top
.constraint(equalTo: boundary.top, constant: insets.constant(for: .top))
.constraint(to: boundary.top, constant: insets.constant(for: .top))
.withPriority(priority)
case .leading:
return layoutItemView
.leading
.constraint(equalTo: boundary.leading, constant: insets.constant(for: .leading))
.constraint(to: boundary.leading, constant: insets.constant(for: .leading))
.withPriority(priority)
case .bottom:
return layoutItemView
.bottom
.constraint(equalTo: boundary.bottom, constant: insets.constant(for: .bottom))
.constraint(to: boundary.bottom, constant: insets.constant(for: .bottom))
.withPriority(priority)
case .trailing:
return layoutItemView
.trailing
.constraint(equalTo: boundary.trailing, constant: insets.constant(for: .trailing))
.constraint(to: boundary.trailing, constant: insets.constant(for: .trailing))
.withPriority(priority)
}
}
Expand All @@ -834,22 +834,22 @@ extension LayoutItem {
case .top:
return layoutItemView
.top
.constraint(equalTo: boundary.top, constant: insets.constant(for: .top))
.constraint(to: boundary.top, constant: insets.constant(for: .top))
.withPriority(priority)
case .left:
return layoutItemView
.left
.constraint(equalTo: boundary.left, constant: insets.constant(for: .left))
.constraint(to: boundary.left, constant: insets.constant(for: .left))
.withPriority(priority)
case .bottom:
return layoutItemView
.bottom
.constraint(equalTo: boundary.bottom, constant: insets.constant(for: .bottom))
.constraint(to: boundary.bottom, constant: insets.constant(for: .bottom))
.withPriority(priority)
case .right:
return layoutItemView
.right
.constraint(equalTo: boundary.right, constant: insets.constant(for: .right))
.constraint(to: boundary.right, constant: insets.constant(for: .right))
.withPriority(priority)
}
}
Expand Down

0 comments on commit e3ef096

Please sign in to comment.