Skip to content
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

Add MacBook Air 2024 #29

Merged
merged 1 commit into from
Jun 16, 2024
Merged
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
19 changes: 17 additions & 2 deletions Sources/DeviceHardware/MacDeviceHardware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class MacDeviceHardware: DeviceHardware {
// MARK: - Model Identifier
enum ModelIdentifier: String {
// MARK: MacBook Air
/// MacBook Air (13-inch, M3, 2024)
case Mac15_12 = "Mac15,12"
/// MacBook Air (15-inch, M3, 2024)
case Mac15_13 = "Mac15,13"
/// MacBook Air (15-inch, M2, 2023)
case Mac14_15 = "Mac14,15"
/// MacBook Air (M2, 2022)
Expand Down Expand Up @@ -221,6 +225,7 @@ public class MacDeviceHardware: DeviceHardware {
/// Mac Studio (2022) / M1 Ultra
case Mac13_2 = "Mac13,2"

// TODO: Add model identifier when new Apple Silicon Series is announced.
// Whether is Apple Silicon Mac or not
func isAppleSiliconMac() -> Bool {
switch self {
Expand All @@ -244,13 +249,15 @@ public class MacDeviceHardware: DeviceHardware {
/// M3, M3 Pro, M3 Max
.Mac15_3, .Mac15_4, .Mac15_5,
.Mac15_6, .Mac15_7, .Mac15_8,
.Mac15_9, .Mac15_10, .Mac15_11:
.Mac15_9, .Mac15_10, .Mac15_11,
.Mac15_12, .Mac15_13:
return true
default:
return false
}
}

// TODO: Add core counts of Neural Engine when new Apple Silicon Series is announced.
// Neural Engine Information
func neuralEngine() -> String {
switch self {
Expand Down Expand Up @@ -279,7 +286,7 @@ public class MacDeviceHardware: DeviceHardware {
case .Mac14_14, .Mac14_8:
return "32-core"
/// M3, M3 Pro, M3 Max
case .Mac15_3, .Mac15_4, .Mac15_5, .Mac15_6, .Mac15_7, .Mac15_8, .Mac15_9, .Mac15_10, .Mac15_11:
case .Mac15_3, .Mac15_4, .Mac15_5, .Mac15_6, .Mac15_7, .Mac15_8, .Mac15_9, .Mac15_10, .Mac15_11, .Mac15_12, .Mac15_13:
return "16-core"
default:
return "None"
Expand All @@ -290,6 +297,10 @@ public class MacDeviceHardware: DeviceHardware {
func modelName() -> String {
switch self {
// MARK: MacBook Air
case .Mac15_12:
return "MacBook Air (13-inch, M3, 2024)"
case .Mac15_13:
return "MacBook Air (15-inch, M3, 2024)"
case .Mac14_15:
return "MacBook Air (15-inch, M2, 2023)"
case .Mac14_2:
Expand Down Expand Up @@ -616,6 +627,7 @@ public extension MacDeviceHardware {
return nil
}

// TODO: Add CPU frequency when new Apple Silicon Series is announced.
// MARK: Apple silicon or not
if modelId.isAppleSiliconMac() {
guard let core = getPhysicalCore() else {
Expand All @@ -630,6 +642,9 @@ public extension MacDeviceHardware {
/// M2 family
case .Mac14_2, .Mac14_7, .Mac14_3, .Mac14_15, .Mac14_5, .Mac14_6, .Mac14_9, .Mac14_10, .Mac14_12, .Mac14_13, .Mac14_14, .Mac14_8:
return "3.49GHz \(core)-core"
/// M3 family
case .Mac15_3, .Mac15_4, .Mac15_5, .Mac15_6, .Mac15_7, .Mac15_8, .Mac15_9, .Mac15_10, .Mac15_11, .Mac15_12, .Mac15_13:
return "4.05GHz \(core)-core"
default:
return nil
}
Expand Down