10 |

11 |
12 | Devices
13 |
14 |
15 |
25 |
26 | Swift package that contains all devices from https://www.theiphonewiki.com/wiki/Models. A common use case is wanting to convert device identifiers (also known as machine identifiers) such as iPhone10,1 to a user friendly name; iPhone 8.
27 |
28 |
29 |
30 |
31 | ## Features
32 |
33 | - All Apple Devices
34 | - 🎧 AirPods
35 | - ⚪️ AirTags
36 | - 📺 AppleTVs
37 | - SiriRemotes
38 | - ⌚️ Apple Watches
39 | - 🏠 HomePods
40 | - 🔲 iPads
41 | - ✏️ Apple Pencils
42 | - ⌨️ Smart Keyboard
43 | - 📱 iPhones
44 | - 📱 iPod Touches
45 | - 💻 Macs
46 | - 📝 Provides device information on:
47 | - Generation - iPhone XR
48 | - Bootroom - Bootrom 3865.0.0.4.7
49 | - Internal Name - N841AP
50 | - Identifier - iPhone11,8
51 | - Storage - 64 GB
52 | - Color/Finish - Black
53 | - Model - MRY42
54 | - more!
55 | - 🕒 Checks for new devices every day.
56 | - 🔌 No networking, runs offline.
57 |
58 | ## Usage
59 |
60 | Each device has an `all` property. Use this to find, filter, map etc. The following are some examples.
61 |
62 | ### Find the generation of current device
63 |
64 | ```swift
65 | let identifier = "iPad3,6"
66 | let iPhone = iPhone.all.first { $0.identifier == identifier }
67 | iPhone.generation // iPad (4th generation)
68 | ```
69 |
70 | ### Find the generation of current device using subscript
71 |
72 | ```swift
73 | let identifier = "iPad3,6"
74 | let iPhone = DeviceList().all[identifer].first!
75 | iPhone.generation // iPad (4th generation)
76 | ```
77 |
78 | ### List all available colors of the iPad Air 2 64 GB
79 |
80 | ```swift
81 | let colors = iPadAir.all.filter {
82 | $0.generation == "iPad Air 2" &&
83 | $0.storage == "64 GB"
84 | }.map { $0.finish }
85 | Set(colors).sorted() // ["Gold", "Silver", "Space Gray"]
86 | ```
87 |
88 | ### List all Apple Watch Identifiers
89 |
90 | ```swift
91 | let identifiers = AppleWatch.all.map { $0.identifier }
92 | Set(identifiers).sorted() // ["Watch1,1", "Watch1,2", "Watch2,3", ...]
93 | ```
94 |
95 | ### List all models of the iPad mini 2, iPad4,5, Silver 16 GB
96 |
97 | ```swift
98 | let iPad = iPadMini.all.first {
99 | $0.identifier == "iPad4,5" &&
100 | $0.finish == "Silver" &&
101 | $0.storage == "16 GB"
102 | }!
103 | iPad.model.components(separatedBy: ", ") // ["ME814", "ME818", "MF074", "MF075", "MF076", "MF544"]
104 | ```
105 |
106 | See FAQ for why `Set` is used in some examples.
107 |
108 | ## Installation
109 |
110 | ### SPM
111 | Add the following to your project:
112 | ```
113 | https://github.com/ptrkstr/Devices
114 | ```
115 |
116 | ## FAQ
117 |
118 | ### What are the list of devices and properties I can access?
119 |
120 | You can see them by going to [Types](/Sources/Devices/Types).
121 |
122 | ### Why can I see duplicated devices? I.e. iPad Air has 3 sets of Silver 16 GB.
123 |
124 | That's because a lot of device models are released slightly differently depending on the region i.e. in China, iPhones can come with two sim card slots as opposed to western regions which either include 1 slot [and an esim]. Those different devices tend to have a different "A" number, FCC ID, Identifier and Model. If you're performing searches for Finish/Color or Storage, you may want to remove duplicates.
125 |
126 | ### Why are some of the returned values a question mark or Unknown?
127 |
128 | The data may not (yet) be available.
129 |
130 | ### How can I split values that contains commas or newlines?
131 |
132 | The model field sometimes contains multiple model names. These can be split with `.model.components(separatedBy: ", ")`
133 | The identifier field sometimes contains multiple identifiers. These can be split with `.identifier.components(separatedBy: "\n")`
134 |
135 | ### How quickly will this update when Apple releases new devices?
136 |
137 | A check is run every day to see if [this](https://www.theiphonewiki.com/wiki/Models) list of devices has changed. If so, a pull request is raised and I'll be notified to review it. You can expect a delay of a few days at the very most.
138 |
139 | ## Alternatives
140 |
141 | - [How to determine the current iPhone/device model?](https://stackoverflow.com/questions/26028918/how-to-determine-the-current-iphone-device-model)
142 | - [How to get device make and model on iOS?](https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios)
143 |
--------------------------------------------------------------------------------
/Sources/Devices/DeviceType.swift:
--------------------------------------------------------------------------------
1 | public typealias Identifier = String
2 | public typealias Generation = String
3 |
4 | public protocol DeviceType: Decodable {
5 | var identifier: Identifier { get }
6 | var generation: Generation { get }
7 | }
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sources/Devices/Extensions/UIDevice+Extension.swift:
--------------------------------------------------------------------------------
1 | //#if canImport(UIKit)
2 | //
3 | //import UIKit
4 | //
5 | //public extension UIDevice {
6 | // var identifier: String {
7 | // var systemInfo = utsname()
8 | // uname(&systemInfo)
9 | // let machineMirror = Mirror(reflecting: systemInfo.machine)
10 | // let identifier = machineMirror.children.reduce("") { identifier, element in
11 | // guard let value = element.value as? Int8, value != 0 else { return identifier }
12 | // return identifier + String(UnicodeScalar(UInt8(value)))
13 | // }
14 | // return identifier
15 | // }
16 | //}
17 | //
18 | //#endif
19 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/Airpod.swift:
--------------------------------------------------------------------------------
1 | public struct Airpod: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let model: String
9 |
10 | enum CodingKeys: String, CodingKey {
11 | case generation = "Generation"
12 | case aNumber = "\"A\" Number"
13 | case bootrom = "Bootrom"
14 | case fccID = "FCC ID"
15 | case internalName = "Internal Name"
16 | case identifier = "Identifier"
17 | case model = "Model"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/Airtag.swift:
--------------------------------------------------------------------------------
1 | public struct Airtag: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let packSize: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case bootrom = "Bootrom"
15 | case fccID = "FCC ID"
16 | case internalName = "Internal Name"
17 | case identifier = "Identifier"
18 | case packSize = "Pack Size"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/ApplePencil.swift:
--------------------------------------------------------------------------------
1 | public struct ApplePencil: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let model: String
8 |
9 | enum CodingKeys: String, CodingKey {
10 | case generation = "Generation"
11 | case aNumber = "\"A\" Number"
12 | case fccID = "FCC ID"
13 | case internalName = "Internal Name"
14 | case identifier = "Identifier"
15 | case model = "Model"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/AppleTV.swift:
--------------------------------------------------------------------------------
1 | public struct AppleTV: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let color: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case color = "Color"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/AppleWatch.swift:
--------------------------------------------------------------------------------
1 | public struct AppleWatch: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let caseMaterial: String
9 | public let finish: String
10 | public let caseSize: String
11 | public let model: String
12 |
13 | enum CodingKeys: String, CodingKey {
14 | case generation = "Generation"
15 | case aNumber = "\"A\" Number"
16 | case bootrom = "Bootrom"
17 | case fccID = "FCC ID"
18 | case internalName = "Internal Name"
19 | case identifier = "Identifier"
20 | case caseMaterial = "Case Material"
21 | case finish = "Finish"
22 | case caseSize = "Case Size"
23 | case model = "Model"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/HomePod.swift:
--------------------------------------------------------------------------------
1 | public struct HomePod: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let color: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case bootrom = "Bootrom"
15 | case fccID = "FCC ID"
16 | case internalName = "Internal Name"
17 | case identifier = "Identifier"
18 | case color = "Color"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/MacBookAir.swift:
--------------------------------------------------------------------------------
1 | public struct MacBookAir: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let color: String
8 | public let storage: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case fccID = "FCC ID"
15 | case internalName = "Internal Name"
16 | case identifier = "Identifier"
17 | case color = "Color"
18 | case storage = "Storage"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/MacBookPro.swift:
--------------------------------------------------------------------------------
1 | public struct MacBookPro: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let color: String
8 | public let storage: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case fccID = "FCC ID"
15 | case internalName = "Internal Name"
16 | case identifier = "Identifier"
17 | case color = "Color"
18 | case storage = "Storage"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/MacMini.swift:
--------------------------------------------------------------------------------
1 | public struct MacMini: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let color: String
8 | public let storage: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case fccID = "FCC ID"
15 | case internalName = "Internal Name"
16 | case identifier = "Identifier"
17 | case color = "Color"
18 | case storage = "Storage"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/SiriRemote.swift:
--------------------------------------------------------------------------------
1 | public struct SiriRemote: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let model: String
8 |
9 | enum CodingKeys: String, CodingKey {
10 | case generation = "Generation"
11 | case aNumber = "\"A\" Number"
12 | case fccID = "FCC ID"
13 | case internalName = "Internal Name"
14 | case identifier = "Identifier"
15 | case model = "Model"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/SmartKeyboard.swift:
--------------------------------------------------------------------------------
1 | public struct SmartKeyboard: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let internalName: String
5 | public let identifier: Identifier
6 | public let iPadCompatibility: String
7 | public let model: String
8 |
9 | enum CodingKeys: String, CodingKey {
10 | case generation = "Generation"
11 | case aNumber = "\"A\" Number"
12 | case internalName = "Internal Name"
13 | case identifier = "Identifier"
14 | case iPadCompatibility = "iPad Compatibility"
15 | case model = "Model"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iMac.swift:
--------------------------------------------------------------------------------
1 | public struct iMac: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let fccID: String
5 | public let internalName: String
6 | public let identifier: Identifier
7 | public let color: String
8 | public let storage: String
9 | public let model: String
10 |
11 | enum CodingKeys: String, CodingKey {
12 | case generation = "Generation"
13 | case aNumber = "\"A\" Number"
14 | case fccID = "FCC ID"
15 | case internalName = "Internal Name"
16 | case identifier = "Identifier"
17 | case color = "Color"
18 | case storage = "Storage"
19 | case model = "Model"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPad.swift:
--------------------------------------------------------------------------------
1 | public struct iPad: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let finish: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case finish = "Finish"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPadAir.swift:
--------------------------------------------------------------------------------
1 | public struct iPadAir: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let finish: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case finish = "Finish"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPadMini.swift:
--------------------------------------------------------------------------------
1 | public struct iPadMini: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let finish: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case finish = "Finish"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPadPro.swift:
--------------------------------------------------------------------------------
1 | public struct iPadPro: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let finish: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case finish = "Finish"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPhone.swift:
--------------------------------------------------------------------------------
1 | public struct iPhone: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let finish: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case finish = "Finish"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/Devices/Types/iPodTouch.swift:
--------------------------------------------------------------------------------
1 | public struct iPodTouch: Decodable, DeviceType {
2 | public let generation: Generation
3 | public let aNumber: String
4 | public let bootrom: String
5 | public let fccID: String
6 | public let internalName: String
7 | public let identifier: Identifier
8 | public let color: String
9 | public let storage: String
10 | public let model: String
11 |
12 | enum CodingKeys: String, CodingKey {
13 | case generation = "Generation"
14 | case aNumber = "\"A\" Number"
15 | case bootrom = "Bootrom"
16 | case fccID = "FCC ID"
17 | case internalName = "Internal Name"
18 | case identifier = "Identifier"
19 | case color = "Color"
20 | case storage = "Storage"
21 | case model = "Model"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Devices_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class Devices_Tests: XCTestCase {
5 |
6 | func test_properties() {
7 | _ = Airpod.all
8 | _ = Airtag.all
9 | _ = ApplePencil.all
10 | _ = AppleTV.all
11 | _ = AppleWatch.all
12 | _ = HomePod.all
13 | _ = iMac.all
14 | _ = iPad.all
15 | _ = iPadAir.all
16 | _ = iPadMini.all
17 | _ = iPadPro.all
18 | _ = iPhone.all
19 | _ = iPodTouch.all
20 | _ = MacBookAir.all
21 | _ = MacBookPro.all
22 | _ = MacMini.all
23 | _ = SiriRemote.all
24 | _ = SmartKeyboard.all
25 | }
26 |
27 | func test_generation_of_identifier() {
28 | let identifier = "iPhone12,5"
29 | let iPhone = iPhone.all.first { $0.identifier == identifier }!
30 | XCTAssertEqual("iPhone 11 Pro Max", iPhone.generation)
31 | }
32 |
33 | func test_colors_iPadAir2_64GB() {
34 | let colors = iPadAir.all.filter {
35 | $0.generation == "iPad Air 2" &&
36 | $0.storage == "64 GB"
37 | }.map { $0.finish }
38 | XCTAssertEqual(["Gold", "Silver", "Space Gray"], Set(colors).sorted())
39 | }
40 |
41 | func test_appleWatchIdentifiers() {
42 | let identifiers = AppleWatch.all.map { $0.identifier }
43 | XCTAssertEqual(
44 | ["Watch1,1", "Watch1,2", "Watch2,3", "Watch2,4", "Watch2,6", "Watch2,7", "Watch3,1", "Watch3,2", "Watch3,3", "Watch3,4", "Watch4,1", "Watch4,2", "Watch4,3", "Watch4,4", "Watch5,1", "Watch5,10", "Watch5,11", "Watch5,12", "Watch5,2", "Watch5,3", "Watch5,4", "Watch5,9"],
45 | Set(identifiers).sorted().prefix(22)
46 | )
47 | }
48 |
49 | func test_models_in_iPadMini2_iPad4_5_Silver_16GB() {
50 | let iPad = iPadMini.all.first {
51 | $0.identifier == "iPad4,5" &&
52 | $0.finish == "Silver" &&
53 | $0.storage == "16 GB"
54 | }!
55 | XCTAssertEqual(
56 | ["ME814", "ME818", "MF074", "MF075", "MF076", "MF544"],
57 | iPad.model.components(separatedBy: ", ")
58 | )
59 | }
60 |
61 | func test_all() {
62 | let ipad = DeviceList().all["iPad3,6"]!.first!
63 | XCTAssertEqual(ipad.generation, "iPad (4th generation)")
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/Airpod_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class Airpod_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Model": ""
16 | }
17 | """
18 | .data(using: .utf8)!
19 | XCTAssertNoThrow(try JSONDecoder().decode(Airpod.self, from: data))
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/Airtag_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class Airtag_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Pack Size": "",
16 | "Model": ""
17 | }
18 | """
19 | .data(using: .utf8)!
20 | XCTAssertNoThrow(try JSONDecoder().decode(Airtag.self, from: data))
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/ApplePencil_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class ApplePencil_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "FCC ID": "",
12 | "Internal Name": "",
13 | "Identifier": "",
14 | "Model": ""
15 | }
16 | """
17 | .data(using: .utf8)!
18 | XCTAssertNoThrow(try JSONDecoder().decode(ApplePencil.self, from: data))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/AppleTV_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class AppleTV_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(AppleTV.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/AppleWatch_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class AppleWatch_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Case Material": "",
16 | "Finish": "",
17 | "Case Size": "",
18 | "Model": ""
19 | }
20 | """
21 | .data(using: .utf8)!
22 | XCTAssertNoThrow(try JSONDecoder().decode(AppleWatch.self, from: data))
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/HomePod_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class HomePod_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Model": ""
17 | }
18 | """
19 | .data(using: .utf8)!
20 | XCTAssertNoThrow(try JSONDecoder().decode(HomePod.self, from: data))
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/MacBookAir_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class MacBookAir_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(MacBookAir.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/MacBookPro_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class MacBookPro_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(MacBookPro.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/MacMini_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class MacMini_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(MacMini.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/SiriRemote_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class SiriRemote_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "FCC ID": "",
12 | "Internal Name": "",
13 | "Identifier": "",
14 | "Model": ""
15 | }
16 | """
17 | .data(using: .utf8)!
18 | XCTAssertNoThrow(try JSONDecoder().decode(SiriRemote.self, from: data))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/SmartKeyboard_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class SmartKeyboard_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Internal Name": "",
12 | "Identifier": "",
13 | "iPad Compatibility": "",
14 | "Model": ""
15 | }
16 | """
17 | .data(using: .utf8)!
18 | XCTAssertNoThrow(try JSONDecoder().decode(SmartKeyboard.self, from: data))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iMac_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iMac_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iMac.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPadAir_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPadAir_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Finish": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPadAir.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPadMini_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPadMini_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Finish": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPadMini.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPadPro_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPadPro_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Finish": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPadPro.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPad_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPad_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Finish": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPad.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPhone_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPhone_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Finish": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPhone.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/DevicesTests/Types/iPodTouch_Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Devices
3 |
4 | final class iPodTouch_Tests: XCTestCase {
5 | func test_decoding() {
6 | let data =
7 | """
8 | {
9 | "Generation": "",
10 | "\\"A\\" Number": "",
11 | "Bootrom": "",
12 | "FCC ID": "",
13 | "Internal Name": "",
14 | "Identifier": "",
15 | "Color": "",
16 | "Storage": "",
17 | "Model": ""
18 | }
19 | """
20 | .data(using: .utf8)!
21 | XCTAssertNoThrow(try JSONDecoder().decode(iPodTouch.self, from: data))
22 | }
23 | }
24 |
--------------------------------------------------------------------------------