Devices

1.1.3

Swift package that contains all devices from https://www.theiphonewiki.com/wiki/Models. Useful when needing to parse machine/device identifier (i.e. iPhone10,1) to device name (iPhone 8).
ptrkstr/Devices

What's New

1.1.3

2022-10-08T12:09:09Z

Full Changelog: 1.1.2...1.1.3

Devices



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.

Features

  • All Apple Devices
    • 🎧 AirPods
    • ⚪️ AirTags
    • 📺 AppleTVs
      • SiriRemotes
    • ⌚️ Apple Watches
    • 🏠 HomePods
    • 🔲 iPads
      • ✏️ Apple Pencils
      • ⌨️ Smart Keyboard
    • 📱 iPhones
    • 📱 iPod Touches
    • 💻 Macs
  • 📝 Provides device information on:
    • Generation - iPhone XR
    • Bootroom - Bootrom 3865.0.0.4.7
    • Internal Name - N841AP
    • Identifier - iPhone11,8
    • Storage - 64 GB
    • Color/Finish - Black
    • Model - MRY42
    • more!
  • 🕒 Checks for new devices every day.
  • 🔌 No networking, runs offline.

Usage

Each device has an all property. Use this to find, filter, map etc. The following are some examples.

Find the generation of current device

let identifier = "iPad3,6"
let iPhone = iPhone.all.first { $0.identifier == identifier }
iPhone.generation // iPad (4th generation)

Find the generation of current device using subscript

let identifier = "iPad3,6"
let iPhone = DeviceList().all[identifer]
iPhone.generation // iPad (4th generation)

List all available colors of the iPad Air 2 64 GB

let colors = iPadAir.all.filter {
    $0.generation == "iPad Air 2" &&
    $0.storage == "64 GB"
}.map { $0.finish }
Set(colors).sorted() // ["Gold", "Silver", "Space Gray"]

List all Apple Watch Identifiers

let identifiers = AppleWatch.all.map { $0.identifier }
Set(identifiers).sorted() // ["Watch1,1", "Watch1,2", "Watch2,3", ...]

List all models of the iPad mini 2, iPad4,5, Silver 16 GB

let iPad = iPadMini.all.first {
    $0.identifier == "iPad4,5" &&
    $0.finish == "Silver" &&
    $0.storage == "16 GB"
}!
iPad.model.components(separatedBy: ", ") // ["ME814", "ME818", "MF074", "MF075", "MF076", "MF544"]

See FAQ for why Set is used in some examples.

Installation

SPM

Add the following to your project:

https://github.com/ptrkstr/Devices

FAQ

What are the list of devices and properties I can access?

You can see them by going to Types.

Why can I see duplicated devices? I.e. iPad Air has 3 sets of Silver 16 GB.

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.

Why are some of the returned values a question mark or Unknown?

The data may not (yet) be available.

How can I split values that contains commas or newlines?

The model field sometimes contains multiple model names. These can be split with .model.components(separatedBy: ", ") The identifier field sometimes contains multiple identifiers. These can be split with .identifier.components(separatedBy: "\n")

How quickly will this update when Apple releases new devices?

A check is run every day to see if this 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.

Alternatives

Description

  • Swift Tools 5.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 19:21:44 GMT-0900 (Hawaii-Aleutian Daylight Time)