Skip to content

Commit

Permalink
Merge pull request #19 from allaboutapps/feature/mpo-avoid-left-right…
Browse files Browse the repository at this point in the history
…-anchor
  • Loading branch information
mbuchetics authored Jun 16, 2021
2 parents 7405316 + fde1465 commit e960c84
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Sources/Toolbox/Extensions/UIKit/UIView+AutoLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ public extension UIView {
return trailingAnchor.constraint(equalTo: anchorView(view).trailingAnchor, constant: constant)
}

func alignLeft(_ view: UIView? = nil, constant: CGFloat = 0) -> NSLayoutConstraint {
return leftAnchor.constraint(equalTo: anchorView(view).leftAnchor, constant: constant)
}

func alignRight(_ view: UIView? = nil, constant: CGFloat = 0) -> NSLayoutConstraint {
return rightAnchor.constraint(equalTo: anchorView(view).rightAnchor, constant: constant)
}

func alignTop(_ view: UIView? = nil, constant: CGFloat = 0) -> NSLayoutConstraint {
return topAnchor.constraint(equalTo: anchorView(view).topAnchor, constant: constant)
}
Expand All @@ -71,8 +63,8 @@ public extension UIView {

func alignEdges(_ view: UIView? = nil, insets: UIEdgeInsets = UIEdgeInsets.init()) -> [NSLayoutConstraint] {
return [
alignLeft(view, constant: insets.left),
alignRight(view, constant: -insets.right),
alignLeading(view, constant: insets.left),
alignTrailing(view, constant: -insets.right),
alignTop(view, constant: insets.top),
alignBottom(view, constant: -insets.bottom)
]
Expand Down

0 comments on commit e960c84

Please sign in to comment.