Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ disabled_rules:
- switch_case_alignment
- type_body_length
- identifier_name
- trailing_comma
- function_body_length

opt_in_rules:
- anyobject_protocol
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
### Bug fixes

- Fixed iPhone Air incorrectly marked as having ultra-wide camera. ([#463](https://github.com/devicekit/DeviceKit/pull/463))
- Fixed Apple Pencil compatibility for M4 iPad Pro, M2/M3 iPad Air, iPad (10th gen), and iPad (A16) models. ([#474](https://github.com/devicekit/DeviceKit/pull/474))
- Fixed `ApplePencilSupport` OptionSet raw values so that `.firstGenerationUsbC` no longer incorrectly overlaps with `.firstGeneration` and `.secondGeneration`. ([#474](https://github.com/devicekit/DeviceKit/pull/474))
- Exclude unhandled files (`Info.plist`, `Device.swift.gyb`) to suppress SPM warnings. ([#484](https://github.com/devicekit/DeviceKit/pull/484))

## Version 5.7.0
Expand Down
5 changes: 3 additions & 2 deletions Example/DeviceKitPlayground.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ if Device.volumeAvailableCapacityForImportantUsage ?? 0 > Int64(1_000) {
// Get the underlying device
let simulator = Device.simulator(.iPhone8Plus)
let realDevice = Device.iPhone8Plus
simulator.realDevice == realDevice // true
realDevice.realDevice == realDevice // true

_ = simulator.realDevice == realDevice // true
_ = realDevice.realDevice == realDevice // true

// Get device thermal state
if device.thermalState == .nominal {
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// swift-tools-version:5.3
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------=== //
//
// This source file is part of the DeviceKit open source project
//
Expand All @@ -8,7 +8,7 @@
// License: https://github.com/dennisweissmann/DeviceKit/blob/master/LICENSE
// Contributors: https://github.com/dennisweissmann/DeviceKit#contributors
//
//===----------------------------------------------------------------------===//
// ===----------------------------------------------------------------------=== //

import PackageDescription

Expand Down
28 changes: 14 additions & 14 deletions Source/Device.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public enum Device {
/// - parameter identifier: The device identifier, e.g. "iPhone7,1". Can be obtained from `Device.identifier`.
///
/// - returns: An initialized `Device`.
public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity function_body_length
public static func mapToDevice(identifier: String) -> Device {
Copy link

Choose a reason for hiding this comment

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

⚠️ Function should have complexity 10 or less: currently complexity equals 140
cyclomatic_complexity Device.generated.swift:626

#if os(iOS)
switch identifier {
case "iPod5,1": return iPodTouch5
Expand Down Expand Up @@ -2197,7 +2197,7 @@ extension Device {

/// The volume’s available capacity in bytes for storing nonessential resources.
@available(iOS 11.0, *)
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { // swiftlint:disable:this identifier_name
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage
}

Expand Down Expand Up @@ -2247,8 +2247,8 @@ extension Device {

public static let firstGeneration = ApplePencilSupport(rawValue: 0x01)
public static let secondGeneration = ApplePencilSupport(rawValue: 0x02)
public static let firstGenerationUsbC = ApplePencilSupport(rawValue: 0x03)
public static let pro = ApplePencilSupport(rawValue: 0x04)
public static let firstGenerationUsbC = ApplePencilSupport(rawValue: 0x04)
public static let pro = ApplePencilSupport(rawValue: 0x08)
}

/// All Apple Pencil Capable Devices
Expand All @@ -2269,8 +2269,8 @@ extension Device {
case .iPadPro12Inch: return .firstGeneration
case .iPadPro12Inch2: return .firstGeneration
case .iPadPro10Inch: return .firstGeneration
case .iPad10: return .firstGenerationUsbC
case .iPadA16: return .firstGenerationUsbC
case .iPad10: return [.firstGeneration, .firstGenerationUsbC]
case .iPadA16: return [.firstGeneration, .firstGenerationUsbC]
case .iPadAir4: return [.secondGeneration, .firstGenerationUsbC]
case .iPadAir5: return [.secondGeneration, .firstGenerationUsbC]
case .iPadMini6: return [.secondGeneration, .firstGenerationUsbC]
Expand All @@ -2282,17 +2282,17 @@ extension Device {
case .iPadPro12Inch5: return [.secondGeneration, .firstGenerationUsbC]
case .iPadPro11Inch4: return [.secondGeneration, .firstGenerationUsbC]
case .iPadPro12Inch6: return [.secondGeneration, .firstGenerationUsbC]
case .iPadPro11M4: return [.secondGeneration, .firstGenerationUsbC, .pro]
case .iPadPro13M4: return [.secondGeneration, .firstGenerationUsbC, .pro]
case .iPadPro11M5: return [.secondGeneration, .firstGenerationUsbC, .pro]
case .iPadPro13M5: return [.secondGeneration, .firstGenerationUsbC, .pro]
case .iPadAir11M2: return [.secondGeneration, .pro]
case .iPadAir13M2: return [.secondGeneration, .pro]
case .iPadAir11M3: return [.secondGeneration, .pro]
case .iPadAir13M3: return [.secondGeneration, .pro]
case .iPadAir11M4: return [.secondGeneration, .pro]
case .iPadAir13M4: return [.secondGeneration, .pro]
case .iPadAir11M2: return [.firstGenerationUsbC, .pro]
case .iPadAir13M2: return [.firstGenerationUsbC, .pro]
case .iPadAir11M3: return [.firstGenerationUsbC, .pro]
case .iPadAir13M3: return [.firstGenerationUsbC, .pro]
case .iPadAir11M4: return [.firstGenerationUsbC, .pro]
case .iPadAir13M4: return [.firstGenerationUsbC, .pro]
case .iPadMiniA17Pro: return [.firstGenerationUsbC, .pro]
case .iPadPro11M4: return [.firstGenerationUsbC, .pro]
case .iPadPro13M4: return [.firstGenerationUsbC, .pro]
case .simulator(let model): return model.applePencilSupport
default: return []
}
Expand Down
Loading