Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zmian committed Feb 12, 2024
1 parent 12c6f4f commit eb39734
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Sources/Xcore/SwiftUI/Components/Device/Biometrics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public struct Biometrics {
return kind
}

if UserInterfaceIdiom.current == .vision {
return .opticID
}

return Device.screen.referenceSize.iPhoneXSeries ? .faceID : .touchID
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ extension Device {
public static let touchID = Capability(rawValue: 1 << 0)
/// - SeeAlso: `Device.current.biometrics.isAvailable` and `Device.current.biometrics.kind`.
public static let faceID = Capability(rawValue: 1 << 1)
/// - SeeAlso: `Device.current.biometrics.isAvailable` and `Device.current.biometrics.kind`.
public static let opticID = Capability(rawValue: 1 << 2)
public static let notch = Capability(rawValue: 1 << 3)
public static let homeIndicator = Capability(rawValue: 1 << 4)
public static let iPhoneXSeries: Capability = [.notch, .faceID, .opticID, .homeIndicator]
public static let iPhoneXSeries: Capability = [.notch, .faceID, .homeIndicator]
}
}

Expand Down
3 changes: 3 additions & 0 deletions Sources/Xcore/SwiftUI/Components/Device/Device+Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ extension Device.Model {
return UIDevice.current.model
#elseif os(watchOS)
return WKInterfaceDevice.current().model
#elseif os(visionOS)
#warning("TODO: Implement")
return "Apple Vision Pro"
#elseif os(macOS)
#warning("TODO: Implement")
return ""
Expand Down
2 changes: 2 additions & 0 deletions Sources/Xcore/SwiftUI/Components/Device/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ extension Device {
return UIDevice.current.systemName
#elseif os(watchOS)
return WKInterfaceDevice.current().systemName
#elseif os(visionOS)
return "visionOS"
#elseif os(macOS)
#warning("TODO: Implement")
return "macOS"
Expand Down
26 changes: 9 additions & 17 deletions Sources/Xcore/SwiftUI/Components/Device/UserInterfaceIdiom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,14 @@ public enum UserInterfaceIdiom: Hashable, CustomStringConvertible {

public var description: String {
switch self {
case .carPlay:
return "CarPlay"
case .mac:
return "Mac"
case .pad:
return "iPad"
case .phone:
return "iPhone"
case .tv:
return "Apple TV"
case .watch:
return "Apple Watch"
case .vision:
return "Apple Vision"
case .unspecified:
return "Unspecified"
case .carPlay: "CarPlay"
case .mac: "Mac"
case .pad: "iPad"
case .phone: "iPhone"
case .tv: "Apple TV"
case .watch: "Apple Watch"
case .vision: "Apple Vision"
case .unspecified: "Unspecified"
}
}
}
Expand All @@ -61,7 +53,7 @@ extension UserInterfaceIdiom {
static var current: Self {
#if targetEnvironment(macCatalyst)
return .mac
#elseif os(iOS) || os(tvOS)
#elseif os(iOS) || os(tvOS) || os(visionOS)
// swiftformat:disable indent
switch UIDevice.current.userInterfaceIdiom {
case .carPlay:
Expand Down
2 changes: 1 addition & 1 deletion Sources/Xcore/SwiftUI/Components/Popup/View+Popup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ extension View {

// MARK: - View Modifier

private struct PopupViewModifier<PopupContent>: ViewModifier where PopupContent: View {
private struct PopupViewModifier<PopupContent: View>: ViewModifier {
init(
isPresented: Binding<Bool>,
style: Popup.Style,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Xcore/SwiftUI/Extensions/View+Window.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension View {
// MARK: - Style

/// A structure representing the style of a window.
public struct WindowStyle: Hashable {
public struct WindowStyle: Hashable, Sendable {
/// A succinct label that identifies the window.
public let label: String?

Expand Down

0 comments on commit eb39734

Please sign in to comment.