Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion Source/Device.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ public enum Device {
public var hasBiometricSensor: Bool {
return isTouchIDCapable || isFaceIDCapable
}

#elseif os(tvOS)
/// All TVs
public static var allTVs: [Device] {
Expand Down Expand Up @@ -1156,3 +1155,46 @@ extension Device {
}
}
#endif

#if os(iOS)
// MARK: - Apple Pencil
extension Device {

/**
This option set describes the current Apple Pencils
- firstGeneration: 1st Generation Apple Pencil
- secondGeneration: 2nd Generation Apple Pencil
*/
public struct ApplePencilSupport: OptionSet {

public var rawValue: UInt
public init(rawValue: UInt) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Let and var should be separated from other statements by a blank line.

self.rawValue = rawValue
}

public static let firstGeneration = ApplePencilSupport(rawValue: 0x01)
public static let secondGeneration = ApplePencilSupport(rawValue: 0x02)
}

/// All Apple Pencil Capable Devices
public static var allApplePencilCapableDevices: [Device] {
return [.iPad6, .iPadAir3, .iPadMini5, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3]
}

/// Returns supported version of the Apple Pencil
public var applePencilSupport: ApplePencilSupport {
switch self {
case .iPad6: return .firstGeneration
case .iPadAir3: return .firstGeneration
case .iPadMini5: return .firstGeneration
case .iPadPro9Inch: return .firstGeneration
case .iPadPro12Inch: return .firstGeneration
case .iPadPro12Inch2: return .firstGeneration
case .iPadPro10Inch: return .firstGeneration
case .iPadPro11Inch: return .secondGeneration
case .iPadPro12Inch3: return .secondGeneration
default: return []
}
}
}
#endif
Loading