@@ -628,6 +628,9 @@ public enum Device {
628628 case " i386 " , " x86_64 " , " arm64 " : return simulator ( mapToDevice ( identifier: ProcessInfo ( ) . environment [ " SIMULATOR_MODEL_IDENTIFIER " ] ?? " watchOS " ) )
629629 default : return unknown ( identifier)
630630 }
631+ #elseif os(visionOS)
632+ // TODO: Replace with proper implementation for visionOS.
633+ return unknown ( identifier)
631634 #else
632635 return unknown ( identifier)
633636 #endif
@@ -879,7 +882,7 @@ public enum Device {
879882 case . simulator( let model) : return model. screenRatio
880883 case . unknown: return ( width: - 1 , height: - 1 )
881884 }
882- #elseif os(tvOS)
885+ #elseif os(tvOS) || os(visionOS)
883886 return ( width: - 1 , height: - 1 )
884887 #else
885888 return ( width: - 1 , height: - 1 )
@@ -986,16 +989,12 @@ public enum Device {
986989
987990 public var isZoomed : Bool ? {
988991 guard isCurrent else { return nil }
989- #if os(xrOS)
990- return nil
991- #else
992992 if Int ( UIScreen . main. scale. rounded ( ) ) == 3 {
993993 // Plus-sized
994994 return UIScreen . main. nativeScale > 2.7 && UIScreen . main. nativeScale < 3
995995 } else {
996996 return UIScreen . main. nativeScale > UIScreen . main. scale
997997 }
998- #endif
999998 }
1000999
10011000 /// All Touch ID Capable Devices
@@ -1162,6 +1161,9 @@ public enum Device {
11621161 return allTVs
11631162 #elseif os(watchOS)
11641163 return allWatches
1164+ #elseif os(visionOS)
1165+ // TODO: Replace with proper implementation for visionOS.
1166+ return [ ]
11651167 #else
11661168 return [ ]
11671169 #endif
@@ -1401,6 +1403,9 @@ public enum Device {
14011403 }
14021404 #elseif os(tvOS)
14031405 return nil
1406+ #elseif os(visionOS)
1407+ // TODO: Replace with proper implementation for visionOS.
1408+ return nil
14041409 #else
14051410 return nil
14061411 #endif
@@ -1421,7 +1426,7 @@ public enum Device {
14211426
14221427 /// The brightness level of the screen.
14231428 public var screenBrightness : Int {
1424- #if os(iOS) && !os(xrOS)
1429+ #if os(iOS)
14251430 return Int ( UIScreen . main. brightness * 100 )
14261431 #else
14271432 return 100
@@ -1554,6 +1559,9 @@ extension Device: CustomStringConvertible {
15541559 case . simulator( let model) : return " Simulator ( \( model. description) ) "
15551560 case . unknown( let identifier) : return identifier
15561561 }
1562+ #elseif os(visionOS)
1563+ // TODO: Replace with proper implementation for visionOS.
1564+ return " Apple Vision Pro "
15571565 #else
15581566 switch self {
15591567 case . simulator( let model) : return " Simulator ( \( model. description) ) "
@@ -1687,6 +1695,9 @@ extension Device: CustomStringConvertible {
16871695 case . simulator( let model) : return " Simulator ( \( model. safeDescription) ) "
16881696 case . unknown( let identifier) : return identifier
16891697 }
1698+ #elseif os(visionOS)
1699+ // TODO: Replace with proper implementation for visionOS.
1700+ return " Apple Vision Pro "
16901701 #else
16911702 switch self {
16921703 case . simulator( let model) : return " Simulator ( \( model. safeDescription) ) "
@@ -1842,7 +1853,7 @@ extension Device.BatteryState: Comparable {
18421853}
18431854#endif
18441855
1845- #if os(iOS) && !os(xrOS)
1856+ #if os(iOS)
18461857extension Device {
18471858 // MARK: Orientation
18481859 /**
@@ -2326,6 +2337,9 @@ extension Device {
23262337 case . simulator( let model) : return model. cpu
23272338 case . unknown: return . unknown
23282339 }
2340+ #elseif os(visionOS)
2341+ // TODO: Replace with proper implementation for visionOS.
2342+ return . unknown
23292343 #else
23302344 return . unknown
23312345 #endif
@@ -2377,6 +2391,9 @@ extension Device.CPU: CustomStringConvertible {
23772391 case . s9: return " S9 "
23782392 case . unknown: return " unknown "
23792393 }
2394+ #elseif os(visionOS)
2395+ // TODO: Replace with proper implementation for visionOS.
2396+ return " unknown "
23802397 #else
23812398 return " unknown "
23822399 #endif
0 commit comments