Skip to content

Commit 22a00c5

Browse files
committed
Add Edges().to(_:)
1 parent 4e22389 commit 22a00c5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

EasyPeasy/PositionAttribute+UIKit.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,29 @@ public class CenterWithinMargins: CompoundAttribute {
324324
}
325325

326326
}
327+
328+
extension Edges {
329+
330+
@available(iOS 9.0, *)
331+
public func to(_ layoutGuide: UILayoutGuide) -> Edges {
332+
self.attributes = [
333+
Top().to(layoutGuide, .top),
334+
Left().to(layoutGuide, .bottom),
335+
Right().to(layoutGuide, .right),
336+
Bottom().to(layoutGuide, .bottom),
337+
]
338+
return self
339+
}
340+
341+
public func to(_ view: UIView) -> Edges {
342+
self.attributes = [
343+
Top().to(view, .top),
344+
Left().to(view, .bottom),
345+
Right().to(view, .right),
346+
Bottom().to(view, .bottom),
347+
]
348+
return self
349+
}
350+
}
327351

328352
#endif

0 commit comments

Comments
 (0)