Skip to content

Commit

Permalink
Remove toBottomMargin method (#284)
Browse files Browse the repository at this point in the history
* Remove toBottomMargin method

* Remove test snapshot images
  • Loading branch information
tinder-cfuller authored Jan 19, 2024
1 parent 1b389b2 commit 9c41ee2
Show file tree
Hide file tree
Showing 18 changed files with 0 additions and 68 deletions.
21 changes: 0 additions & 21 deletions Sources/Layout/LayoutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -657,27 +657,6 @@ extension LayoutItem {
toMargins(canonical: [.left, .right], inset: inset, priority: priority)
}

public func toBottomMargin(
minInset: CGFloat,
priority: UILayoutPriority = .required
) -> LayoutItem {
addingSuperviewConstraints { layoutItem in
if let superview: UIView = layoutItem.layoutItemView.superview {
layoutItem.layoutItemView
.constraint(for: .bottom,
to: .bottomMargin,
of: superview)
.withPriority(priority - min(1, priority.rawValue / 2))
layoutItem.layoutItemView
.bottom
.constraint(is: .lessThanOrEqual,
to: superview.bottom,
constant: -minInset)
.withPriority(priority)
}
}
}

// MARK: - Safe Area

/// Adds constraints aligning the edges of the ``layoutItemView`` to the safe area of the superview with
Expand Down
23 changes: 0 additions & 23 deletions Tests/LayoutTests/LayoutItemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -750,29 +750,6 @@ final class LayoutItemTests: XCTestCase {
}
}

func testToBottomMargin_andWithPriority() {
assertLayout(devices: Device.portraitTestDevices + Device.modernLandscapeTestDevices) { view in
view.layout {

// To Bottom Margin Leading with Default Priority

pinkView
.size(width: 100, height: 100)
.to(.leading)
.toBottomMargin(minInset: 200, priority: .high)
.toBottomMargin(minInset: 100)

// To Bottom Margin Trailing with Priority

blueView
.size(width: 100, height: 100)
.to(.trailing)
.toBottomMargin(minInset: 50, priority: .low)
.toBottomMargin(minInset: 100, priority: .high)
}
}
}

// MARK: - Safe Area

func testToSafeAreaWithDirectionalEdgeInsetsPriority() {
Expand Down
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

0 comments on commit 9c41ee2

Please sign in to comment.