@@ -85,71 +85,6 @@ extension NSEdgeInsets: Equatable {}
85
85
86
86
87
87
88
- #if canImport(SwiftUI) && !RECTANGLETOOLS_EXCLUDE_SWIFTUI_EDGEINSETS
89
- import SwiftUI
90
-
91
-
92
-
93
- @available ( macOS 10 . 15 , * )
94
- @available ( iOS 13 , * )
95
- @available ( tvOS 13 , * )
96
- @available ( watchOS 6 , * )
97
- extension EdgeInsets : FourSidedAbsolute {
98
- public init ( top: CGFloat , right: CGFloat , bottom: CGFloat , left: CGFloat ) {
99
- switch UserInterfaceLayoutDirection . current {
100
- case . leftToRight:
101
- self . init ( top: top, leading: left, bottom: bottom, trailing: right)
102
-
103
- case . rightToLeft:
104
- self . init ( top: top, leading: right, bottom: bottom, trailing: left)
105
-
106
- @unknown default :
107
- assertionFailure ( " Unknown user interface layout direction (will assume LTR): \( UserInterfaceLayoutDirection . current) " )
108
- self . init ( top: top, leading: left, bottom: bottom, trailing: right)
109
- }
110
- }
111
-
112
-
113
- public init ( top: CGFloat , trailing: CGFloat , bottom: CGFloat , leading: CGFloat ) {
114
- self . init ( top: top, leading: leading, bottom: bottom, trailing: trailing)
115
- }
116
- }
117
-
118
-
119
-
120
- @available ( iOS 13 . 0 , macOS 10 . 15 , tvOS 13 . 0 , watchOS 6 . 0 , * )
121
- public extension EdgeInsets {
122
- /// The value of whichever edge inset is leading in the current app's UI direction
123
- var right : CGFloat {
124
- switch UserInterfaceLayoutDirection . current {
125
- case . leftToRight: return trailing
126
- case . rightToLeft: return leading
127
- @unknown default :
128
- assertionFailure ( " Unknown user interface layout direction (will assume LTR): \( UserInterfaceLayoutDirection . current) " )
129
- return trailing
130
- }
131
- }
132
-
133
-
134
- /// The value of whichever edge inset is trailing in the current app's UI direction
135
- var left : CGFloat {
136
- switch UserInterfaceLayoutDirection . current {
137
- case . leftToRight: return leading
138
- case . rightToLeft: return trailing
139
- @unknown default :
140
- assertionFailure ( " Unknown user interface layout direction (will assume LTR): \( UserInterfaceLayoutDirection . current) " )
141
- return leading
142
- }
143
- }
144
- }
145
- #else
146
-
147
- public typealias EdgeInsets = NativeEdgeInsets
148
-
149
- #endif
150
-
151
-
152
-
153
88
@available ( watchOS 2 . 1 , * )
154
89
public extension UserInterfaceLayoutDirection {
155
90
// TODO: Move this to some other package
0 commit comments