Skip to content

Commit

Permalink
Merge pull request #97 from hyperoslo/improve/constrants-even-more
Browse files Browse the repository at this point in the history
Improve constrant methods
  • Loading branch information
zenangst authored Jan 27, 2017
2 parents eccad71 + d2208c6 commit 40bf687
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/iOS/Constraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct Constraint {
}
}

public static func on(constraints: NSLayoutConstraint ...) {
public static func on(_ constraints: NSLayoutConstraint ...) {
on(constraints: constraints)
}
}
Expand All @@ -25,12 +25,12 @@ public extension UIView {
}

@available(iOS 9, *)
func pinEdges(view: UIView) {
func pinEdges(view: UIView, inset: UIEdgeInsets = UIEdgeInsets.zero) {
Constraint.on(constraints: [
leadingAnchor.constraint(equalTo: view.leadingAnchor),
trailingAnchor.constraint(equalTo: view.trailingAnchor),
topAnchor.constraint(equalTo: view.topAnchor),
bottomAnchor.constraint(equalTo: view.bottomAnchor)
leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: inset.left),
trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: inset.right),
topAnchor.constraint(equalTo: view.topAnchor, constant: inset.top),
bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: inset.bottom)
])
}

Expand Down

0 comments on commit 40bf687

Please sign in to comment.