From 09fa41daa0be2ed3d10b73b693d63f9e5f9b7401 Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Mon, 27 Feb 2023 15:52:27 +0100 Subject: [PATCH] Cleanup --- Sources/DeviceInformation/DeviceInfo.swift | 1 - .../PlatformIdentifiers.swift | 3 --- .../DeviceInfoTests.swift | 19 +++++++++---------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Sources/DeviceInformation/DeviceInfo.swift b/Sources/DeviceInformation/DeviceInfo.swift index 52ecfec..fbace32 100644 --- a/Sources/DeviceInformation/DeviceInfo.swift +++ b/Sources/DeviceInformation/DeviceInfo.swift @@ -64,7 +64,6 @@ public struct DeviceInfo: Equatable, Identifiable, Sendable { /// The operating system information. public let operatingSystem: OperatingSystem - /// See `Identifiable.id`. @inlinable public var id: String { identifier } diff --git a/Sources/DeviceInformation/PlatformIdentifiers.swift b/Sources/DeviceInformation/PlatformIdentifiers.swift index fbd9563..45153de 100644 --- a/Sources/DeviceInformation/PlatformIdentifiers.swift +++ b/Sources/DeviceInformation/PlatformIdentifiers.swift @@ -1,5 +1,3 @@ -import Sysctl - // Helpful pages: // - https://everymac.com/ // - https://www.theiphonewiki.com/wiki/Main_Page @@ -223,7 +221,6 @@ extension DeviceInfo { "AirTag1,1" : "AirTags", - // TODO: Add (more / older) Macs // MARK: Macs "iMac21,1" : "iMac 24\" M1", "iMac21,2" : "iMac 24\" M1", diff --git a/Tests/DeviceInformationTests/DeviceInfoTests.swift b/Tests/DeviceInformationTests/DeviceInfoTests.swift index 4cf5b00..15b6c91 100644 --- a/Tests/DeviceInformationTests/DeviceInfoTests.swift +++ b/Tests/DeviceInformationTests/DeviceInfoTests.swift @@ -11,11 +11,11 @@ import SwiftUI final class DeviceInfoTests: XCTestCase { func testCurrentDeviceInfo() { let deviceInfo = DeviceInfo.current - #if os(macOS) || targetEnvironment(macCatalyst) +#if os(macOS) || targetEnvironment(macCatalyst) XCTAssertEqual(deviceInfo.identifier, SystemControl().hardware.model) - #else +#else XCTAssertEqual(deviceInfo.identifier, SystemControl().hardware.machine) - #endif +#endif XCTAssertEqual(deviceInfo.id, deviceInfo.identifier) XCTAssertEqual(deviceInfo.name, DeviceInfo._deviceIdentifierToNameMapping[deviceInfo.identifier]) @@ -26,14 +26,13 @@ final class DeviceInfoTests: XCTestCase { XCTAssertEqual(deviceInfo.operatingSystem.build, SystemControl().kernel.osBuild) } - #if arch(arm64) || arch(x86_64) - #if canImport(Combine) && canImport(SwiftUI) +#if arch(arm64) || arch(x86_64) +#if canImport(Combine) && canImport(SwiftUI) func testSwiftUIEnvironment() throws { - guard #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) else { - throw XCTSkip() - } + guard #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) + else { throw XCTSkip() } XCTAssertEqual(EnvironmentValues().deviceInfo, .current) } - #endif - #endif +#endif +#endif }