Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Feb 27, 2023
1 parent 9bb082b commit 09fa41d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
1 change: 0 additions & 1 deletion Sources/DeviceInformation/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
3 changes: 0 additions & 3 deletions Sources/DeviceInformation/PlatformIdentifiers.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Sysctl

// Helpful pages:
// - https://everymac.com/
// - https://www.theiphonewiki.com/wiki/Main_Page
Expand Down Expand Up @@ -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",
Expand Down
19 changes: 9 additions & 10 deletions Tests/DeviceInformationTests/DeviceInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
}

0 comments on commit 09fa41d

Please sign in to comment.