File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
Sources/RectangleTools/Default Conformances Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -157,25 +157,24 @@ public extension UserInterfaceLayoutDirection {
157157 // TODO: Move this to some other package
158158 @inline ( __always)
159159 static var current : UserInterfaceLayoutDirection {
160+ #if canImport(WatchKit)
161+ let legacyCurrent = WKInterfaceDevice . current ( ) . layoutDirection
162+ #elseif canImport(UIKit)
163+ let legacyCurrent = UIApplication . shared. userInterfaceLayoutDirection
164+ #elseif canImport(AppKit)
165+ let legacyCurrent = NSApp ? . userInterfaceLayoutDirection ?? . leftToRight
166+ #endif
167+
160168 #if canImport(SwiftUI)
161- #if canImport(UIKit)
162- let legacyCurrent = UIApplication . shared. userInterfaceLayoutDirection
163- #elseif canImport(AppKit)
164- let legacyCurrent = NSApp ? . userInterfaceLayoutDirection ?? . leftToRight
165- #endif
166169 switch legacyCurrent {
167170 case . leftToRight: return . leftToRight
168171 case . rightToLeft: return . rightToLeft
169172 @unknown default :
170173 assertionFailure ( " Unknown user interface layout direction (will assume LTR): \( UserInterfaceLayoutDirection . current) " )
171174 return . leftToRight
172175 }
173- #elseif canImport(WatchKit)
174- return WKInterfaceDevice . current ( ) . layoutDirection
175- #elseif canImport(UIKit)
176- return UIApplication . shared. userInterfaceLayoutDirection
177- #elseif canImport(AppKit)
178- return NSApp ? . userInterfaceLayoutDirection ?? . leftToRight
176+ #else
177+ return legacyCurrent
179178 #endif
180179 }
181180}
You can’t perform that action at this time.
0 commit comments