Skip to content

Commit 3a464be

Browse files
Rename from|to on inset|offset keywords
1 parent 8e375cd commit 3a464be

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

Sources/DeclarativeLayoutKit/AutoLayout/DSL/FromToRelation.swift renamed to Sources/DeclarativeLayoutKit/AutoLayout/DSL/InsetOffsetRelation.swift

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ import UIKit
99

1010

1111
public extension HorizontalRelativeAutoLayoutAnchorConvertible {
12+
@available(*, deprecated, renamed: "inset")
1213
func to(_ insetAnchor: NSLayoutXAxisAnchor) -> HorizontalRelativeAutoLayoutAnchor {
14+
inset(insetAnchor)
15+
}
16+
17+
@available(*, deprecated, renamed: "offset")
18+
func from(_ offsetAnchor: NSLayoutXAxisAnchor) -> HorizontalRelativeAutoLayoutAnchor {
19+
offset(offsetAnchor)
20+
}
21+
22+
func inset(_ insetAnchor: NSLayoutXAxisAnchor) -> HorizontalRelativeAutoLayoutAnchor {
1323
var copy = asHorizontalRelativeAutoLayoutAnchor()
1424

1525
copy.constant = RelativeAutoLayoutConstant(
@@ -22,7 +32,7 @@ public extension HorizontalRelativeAutoLayoutAnchorConvertible {
2232
return copy
2333
}
2434

25-
func from(_ offsetAnchor: NSLayoutXAxisAnchor) -> HorizontalRelativeAutoLayoutAnchor {
35+
func offset(_ offsetAnchor: NSLayoutXAxisAnchor) -> HorizontalRelativeAutoLayoutAnchor {
2636
var copy = asHorizontalRelativeAutoLayoutAnchor()
2737

2838
copy.constant = RelativeAutoLayoutConstant(
@@ -37,7 +47,17 @@ public extension HorizontalRelativeAutoLayoutAnchorConvertible {
3747
}
3848

3949
public extension VerticalRelativeAutoLayoutAnchorConvertible {
40-
func to(_ anchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
50+
@available(*, deprecated, renamed: "inset")
51+
func to(_ insetAnchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
52+
inset(insetAnchor)
53+
}
54+
55+
@available(*, deprecated, renamed: "offset")
56+
func from(_ offsetAnchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
57+
offset(offsetAnchor)
58+
}
59+
60+
func inset(_ anchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
4161
var copy = asVerticalRelativeAutoLayoutAnchor()
4262

4363
copy.constant = RelativeAutoLayoutConstant(
@@ -50,7 +70,7 @@ public extension VerticalRelativeAutoLayoutAnchorConvertible {
5070
return copy
5171
}
5272

53-
func from(_ anchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
73+
func offset(_ anchor: NSLayoutYAxisAnchor) -> VerticalRelativeAutoLayoutAnchor {
5474
var copy = asVerticalRelativeAutoLayoutAnchor()
5575

5676
copy.constant = RelativeAutoLayoutConstant(
@@ -65,7 +85,17 @@ public extension VerticalRelativeAutoLayoutAnchorConvertible {
6585
}
6686

6787
public extension BidirectionRelativeAutoLayoutAnchorConvertible {
68-
func to(_ target: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchor {
88+
@available(*, deprecated, renamed: "inset")
89+
func to(_ insetAnchor: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchorConvertible {
90+
inset(insetAnchor)
91+
}
92+
93+
@available(*, deprecated, renamed: "offset")
94+
func from(_ offsetAnchor: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchorConvertible {
95+
offset(offsetAnchor)
96+
}
97+
98+
func inset(_ target: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchor {
6999
var copy = asBidirectionalRelativeAutoLayoutAnchor()
70100

71101
copy.constant = RelativeAutoLayoutConstant(
@@ -78,7 +108,7 @@ public extension BidirectionRelativeAutoLayoutAnchorConvertible {
78108
return copy
79109
}
80110

81-
func from(_ target: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchor {
111+
func offset(_ target: AutoLauoutGuide) -> BidirectionRelativeAutoLayoutAnchor {
82112
var copy = asBidirectionalRelativeAutoLayoutAnchor()
83113

84114
copy.constant = RelativeAutoLayoutConstant(

0 commit comments

Comments
 (0)