Skip to content

Commit 0c89cd5

Browse files
directionalHorizontalAnchor – leading|trailing bidirectional anchor helper
1 parent d549b28 commit 0c89cd5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/DeclarativeLayoutKit/AutoLayout/AnchorsFactory.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public extension AutoLayoutItemConvertible {
113113
.rightAnchor(anchor.toAxisAnchor(anchorPath: { $0.rightAnchor }))
114114
}
115115

116+
func directionalHorizontalAnchor(_ anchor: BidirectionRelativeAutoLayoutAnchorConvertible) -> AutoLayoutItem {
117+
leadingAnchor(anchor.toAxisAnchor(anchorPath: { $0.leadingAnchor }))
118+
.trailingAnchor(anchor.toAxisAnchor(anchorPath: { $0.trailingAnchor }))
119+
}
120+
116121
func centerAnchor(_ anchor: BidirectionRelativeAutoLayoutAnchorConvertible) -> AutoLayoutItem {
117122
centerYAnchor(anchor.toAxisAnchor(anchorPath: { $0.centerYAnchor }))
118123
.centerXAnchor(anchor.toAxisAnchor(anchorPath: { $0.centerXAnchor }))

0 commit comments

Comments
 (0)