-
Notifications
You must be signed in to change notification settings - Fork 449
Fix building for visionOS. #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -628,6 +628,9 @@ public enum Device { | |||
case "i386", "x86_64", "arm64": return simulator(mapToDevice(identifier: ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "watchOS")) | ||||
default: return unknown(identifier) | ||||
} | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
return unknown(identifier) | ||||
#else | ||||
return unknown(identifier) | ||||
#endif | ||||
|
@@ -879,7 +882,7 @@ public enum Device { | |||
case .simulator(let model): return model.screenRatio | ||||
case .unknown: return (width: -1, height: -1) | ||||
} | ||||
#elseif os(tvOS) | ||||
#elseif os(tvOS) || os(visionOS) | ||||
return (width: -1, height: -1) | ||||
#else | ||||
return (width: -1, height: -1) | ||||
|
@@ -986,16 +989,12 @@ public enum Device { | |||
|
||||
public var isZoomed: Bool? { | ||||
guard isCurrent else { return nil } | ||||
#if os(xrOS) | ||||
return nil | ||||
#else | ||||
if Int(UIScreen.main.scale.rounded()) == 3 { | ||||
// Plus-sized | ||||
return UIScreen.main.nativeScale > 2.7 && UIScreen.main.nativeScale < 3 | ||||
} else { | ||||
return UIScreen.main.nativeScale > UIScreen.main.scale | ||||
} | ||||
#endif | ||||
} | ||||
|
||||
/// All Touch ID Capable Devices | ||||
|
@@ -1162,6 +1161,9 @@ public enum Device { | |||
return allTVs | ||||
#elseif os(watchOS) | ||||
return allWatches | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return [] | ||||
#else | ||||
return [] | ||||
#endif | ||||
|
@@ -1401,6 +1403,9 @@ public enum Device { | |||
} | ||||
#elseif os(tvOS) | ||||
return nil | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return nil | ||||
#else | ||||
return nil | ||||
#endif | ||||
|
@@ -1421,7 +1426,7 @@ public enum Device { | |||
|
||||
/// The brightness level of the screen. | ||||
public var screenBrightness: Int { | ||||
#if os(iOS) && !os(xrOS) | ||||
#if os(iOS) | ||||
return Int(UIScreen.main.brightness * 100) | ||||
#else | ||||
return 100 | ||||
|
@@ -1554,6 +1559,9 @@ extension Device: CustomStringConvertible { | |||
case .simulator(let model): return "Simulator (\(model.description))" | ||||
case .unknown(let identifier): return identifier | ||||
} | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return "Apple Vision Pro" | ||||
#else | ||||
switch self { | ||||
case .simulator(let model): return "Simulator (\(model.description))" | ||||
|
@@ -1687,6 +1695,9 @@ extension Device: CustomStringConvertible { | |||
case .simulator(let model): return "Simulator (\(model.safeDescription))" | ||||
case .unknown(let identifier): return identifier | ||||
} | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return "Apple Vision Pro" | ||||
#else | ||||
switch self { | ||||
case .simulator(let model): return "Simulator (\(model.safeDescription))" | ||||
|
@@ -1842,7 +1853,7 @@ extension Device.BatteryState: Comparable { | |||
} | ||||
#endif | ||||
|
||||
#if os(iOS) && !os(xrOS) | ||||
#if os(iOS) | ||||
extension Device { | ||||
// MARK: Orientation | ||||
/** | ||||
|
@@ -2326,6 +2337,9 @@ extension Device { | |||
case .simulator(let model): return model.cpu | ||||
case .unknown: return .unknown | ||||
} | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return .unknown | ||||
#else | ||||
return .unknown | ||||
#endif | ||||
|
@@ -2377,6 +2391,9 @@ extension Device.CPU: CustomStringConvertible { | |||
case .s9: return "S9" | ||||
case .unknown: return "unknown" | ||||
} | ||||
#elseif os(visionOS) | ||||
// TODO: Replace with proper implementation for visionOS. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
return "unknown" | ||||
#else | ||||
return "unknown" | ||||
#endif | ||||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo
Device.generated.swift:632