diff --git a/OpenMacHelper/Extensions/Foundation/Measurement.swift b/OpenMacHelper/Extensions/Foundation/Measurement.swift index 1bc51d4..5406322 100644 --- a/OpenMacHelper/Extensions/Foundation/Measurement.swift +++ b/OpenMacHelper/Extensions/Foundation/Measurement.swift @@ -23,26 +23,28 @@ extension Measurement { extension UnitFrequency? { init(_ substring: Substring?) { - self = switch substring { - case "Hz": .hertz - case "kHz": .kilohertz - case "MHz": .megahertz - case "GHz": .gigahertz - default: nil - } + self = + switch substring { + case "Hz": .hertz + case "kHz": .kilohertz + case "MHz": .megahertz + case "GHz": .gigahertz + default: nil + } } } extension UnitInformationStorage? { init(_ substring: Substring?) { - self = switch substring { - case "B": .bytes - case "KB": .kilobytes - case "MB": .megabytes - case "GB": .gigabytes - case "TB": .terabytes - default: nil - } + self = + switch substring { + case "B": .bytes + case "KB": .kilobytes + case "MB": .megabytes + case "GB": .gigabytes + case "TB": .terabytes + default: nil + } } } diff --git a/OpenMacHelper/Types/SystemInformation/Hardware.swift b/OpenMacHelper/Types/SystemInformation/Hardware.swift index 072a6e7..9755192 100644 --- a/OpenMacHelper/Types/SystemInformation/Hardware.swift +++ b/OpenMacHelper/Types/SystemInformation/Hardware.swift @@ -19,29 +19,30 @@ extension SystemInformation { static let appleSiliconBased: Bool = SystemProfiler.hardware.contains(key: "chip_type") static let intelBased: Bool = SystemProfiler.hardware.contains(key: "cpu_type") static let isLaptop: Bool = name.hasPrefix("MacBook") - static let systemImage: String = switch name { - case _ where name.hasPrefix("MacBook"): - if #available(macOS 14, *) { + static let systemImage: String = + switch name { + case _ where name.hasPrefix("MacBook"): + if #available(macOS 14, *) { + switch identifier { + case "Mac14,7": "macbook.gen1" + case _ where identifier.hasPrefix("MacBookPro18"): "macbook.gen2" + case _ where identifier.hasPrefix("MacBook"): "macbook.gen1" + default: "macbook.gen2" + } + } else { "laptopcomputer" } + case "iMac", "iMac Pro": "desktopcomputer" + case "Mac mini": "macmini" + case "Mac Studio": if #available(macOS 13, *) { "macstudio" } else { "macmini" } + case "Mac Pro": switch identifier { - case "Mac14,7": "macbook.gen1" - case _ where identifier.hasPrefix("MacBookPro18"): "macbook.gen2" - case _ where identifier.hasPrefix("MacBook"): "macbook.gen1" - default: "macbook.gen2" + case "MacPro3,1", "MacPro4,1", "MacPro5,1": "macpro.gen1" + case "MacPro6,1": "macpro.gen2" + default: "macpro.gen3" } - } else { "laptopcomputer" } - case "iMac", "iMac Pro": "desktopcomputer" - case "Mac mini": "macmini" - case "Mac Studio": if #available(macOS 13, *) { "macstudio" } else { "macmini" } - case "Mac Pro": - switch identifier { - case "MacPro3,1", "MacPro4,1", "MacPro5,1": "macpro.gen1" - case "MacPro6,1": "macpro.gen2" - default: "macpro.gen3" + case "Xserve": "xserve" + case _ where name.hasPrefix("Apple Virtual Machine"): "macwindow" + default: if #available(macOS 15, *) { "desktopcomputer.and.macbook" } else { "desktopcomputer" } } - case "Xserve": "xserve" - case _ where name.hasPrefix("Apple Virtual Machine"): "macwindow" - default: if #available(macOS 15, *) { "desktopcomputer.and.macbook" } else { "desktopcomputer" } - } nonisolated(unsafe) static let marketingName: LocalizedStringKey? = { guard let serialNumber = Machine.serialNumber, [11, 12].contains(serialNumber.count) else { return nil } let url: String = """ diff --git a/OpenMacHelper/Types/SystemInformation/Software.swift b/OpenMacHelper/Types/SystemInformation/Software.swift index 9a57a02..5074a8e 100644 --- a/OpenMacHelper/Types/SystemInformation/Software.swift +++ b/OpenMacHelper/Types/SystemInformation/Software.swift @@ -37,14 +37,15 @@ extension SystemInformation { static let components = (SystemProfiler.software?["os_version"] as? String)?.split(separator: " ") static let name: String? = String(components?[0]) static let version: VersionNumber? = VersionNumber(components?[1]) - static let marketingName: String? = switch version?.major { - case 11: "Big Sur" - case 12: "Monterey" - case 13: "Ventura" - case 14: "Sonoma" - case 15: "Sequoia" - default: nil - } + static let marketingName: String? = + switch version?.major { + case 11: "Big Sur" + case 12: "Monterey" + case 13: "Ventura" + case 14: "Sonoma" + case 15: "Sequoia" + default: nil + } static let build: String? = components?.last?.trimmingCharacters(in: .parentheses) static let loaderVersion: VersionNumber? = VersionNumber(SystemProfiler.hardware?["os_loader_version"]) }