Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say what Apple Intelligence may keep on a MacBook Neo too

Țugui Dragoș071e7df87cca
diff --git a/Packages/PeelCore/Sources/PeelCore/Home/AppleIntelligence.swift b/Packages/PeelCore/Sources/PeelCore/Home/AppleIntelligence.swift
index 958722da..bd1b75c8 100644
--- a/Packages/PeelCore/Sources/PeelCore/Home/AppleIntelligence.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Home/AppleIntelligence.swift
@@ -1,17 +1,25 @@
import Foundation
/// What Apple says Apple Intelligence can keep on a Mac with macOS 27 (support.apple.com/121115): up to 14 GB on a Mac
-/// with M3 or later and at least 12 GB of unified memory, up to 8 GB on any other Mac with M1 or later.
+/// with M3 or later and at least 12 GB of unified memory, up to 8 GB on any other Mac it names: M1 or later, and
+/// MacBook Neo with A18 Pro.
public enum AppleIntelligence {
public static let onThisMac = storage(
chip: DeviceInfo.sysctl("machdep.cpu.brand_string") ?? "", memory: Int64(ProcessInfo.processInfo.physicalMemory)
)
static func storage(chip: String, memory: Int64) -> Int64? {
- let name = "Apple M"
- guard chip.hasPrefix(name),
- let generation = Int(chip.dropFirst(name.count).prefix { $0.isASCII && $0.isNumber }), generation >= 1
- else { return nil }
- return generation >= 3 && memory >= 12 * 1_073_741_824 ? 14_000_000_000 : 8_000_000_000
+ if let generation = generation(of: chip, after: "Apple M"), generation >= 1 {
+ return generation >= 3 && memory >= 12 * 1_073_741_824 ? 14_000_000_000 : 8_000_000_000
+ }
+ if let generation = generation(of: chip, after: "Apple A"), generation >= 18 {
+ return 8_000_000_000
+ }
+ return nil
+ }
+
+ private static func generation(of chip: String, after name: String) -> Int? {
+ guard chip.hasPrefix(name) else { return nil }
+ return Int(chip.dropFirst(name.count).prefix { $0.isASCII && $0.isNumber })
}
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AppleIntelligenceTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AppleIntelligenceTests.swift
index 90704d3b..4a5e336a 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AppleIntelligenceTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AppleIntelligenceTests.swift
@@ -13,6 +13,9 @@ struct AppleIntelligenceTests {
#expect(AppleIntelligence.storage(chip: "Apple M10", memory: 24 * gibibyte) == 14_000_000_000)
#expect(AppleIntelligence.storage(chip: "Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz", memory: 16 * gibibyte) == nil)
#expect(AppleIntelligence.storage(chip: "Apple Mystery", memory: 16 * gibibyte) == nil)
+ #expect(AppleIntelligence.storage(chip: "Apple A18 Pro", memory: 8 * gibibyte) == 8_000_000_000)
+ #expect(AppleIntelligence.storage(chip: "Apple A17 Pro", memory: 8 * gibibyte) == nil)
+ #expect(AppleIntelligence.storage(chip: "Apple Almost", memory: 8 * gibibyte) == nil)
#expect(AppleIntelligence.storage(chip: "", memory: 16 * gibibyte) == nil)
}
}