Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 18, 2020
1 parent 3c1eaa9 commit 21b0eee
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/Align.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,6 @@ public struct AnchorCollectionEdges {
let item: LayoutItem
var isAbsolute = false

private var anchors: [Anchor<AnchorType.Edge, Any>] {
let attributes = isAbsolute ?
[NSLayoutConstraint.Attribute.left, .bottom, .right, .top] :
[NSLayoutConstraint.Attribute.leading, .bottom, .trailing, .top]
return attributes.map { Anchor(item, $0) }
}

// By default, edges use locale-specific `.leading` and `.trailing`
public func absolute() -> AnchorCollectionEdges {
AnchorCollectionEdges(item: item, isAbsolute: true)
Expand All @@ -273,6 +266,13 @@ public struct AnchorCollectionEdges {

// MARK: Core

private var anchors: [Anchor<AnchorType.Edge, Any>] {
let attributes = isAbsolute ?
[NSLayoutConstraint.Attribute.left, .bottom, .right, .top] :
[NSLayoutConstraint.Attribute.leading, .bottom, .trailing, .top]
return attributes.map { Anchor(item, $0) }
}

@discardableResult public func equal(_ collection: AnchorCollectionEdges, insets: EdgeInsets) -> [NSLayoutConstraint] {
zip(anchors, collection.anchors).map { $0.equal($1, constant: insets.inset(for: $0.attribute, edge: true)) }
}
Expand Down

0 comments on commit 21b0eee

Please sign in to comment.