Skip to content

A best-effort compilation of all of Apple's device identifiers

License

Notifications You must be signed in to change notification settings

clo4/apple_device_identifiers

Repository files navigation

apple_device_identifiers

StructureUsageSourcesContributingLicense

A best-effort compilation of Apple's device identifiers, starting from the late 2000s. Everything in this repository is public domain (see UNLICENSE), so you can vendor any files you need without having to give credit.

If you notice something wrong or missing, please open an issue!

Structure

devices/*.json

These files contain the mappings of name to ID. They're manually curated.

devices.json, ids.json

Generated JSON files containing all the data from the JSON files above.

mod.ts

A generated TypeScript module that makes it easy to use this data from Deno.

build.ts

A Deno script that builds devices.json and mod.ts using the data in the devices directory. See #contributing.

Usage

As this project is public domain, you can vendor the JSON files you need, or request them from githubusercontent. No crediting is required, no license to add to a giant list.


There's also a TypeScript module generated for Deno. Because this repository is not versioned, you must always pin to a specific commit hash.

deps/devices.ts

export * from "https://raw.githubusercontent.com/SeparateRecords/apple_device_identifiers/<COMMIT>/mod.ts";

mod.ts

import { devices, Identifier } from "./deps/devices.ts";

const id: Identifier = devices["iPad mini 3"];

Libraries should use AnyIdentifier instead of Identifier to allow any string to be assigned, while still providing suggestions. Read the documentation for information on the exported value and types.

Sources & Resources

To the best of my knowledge, there's no official list of identifiers, and even the products themselves don't always have canonical names. As a result, the data in this repository had to be gathered from a variety of sources.

List device_traits.db files

These can be opened using the sqlite3 CLI, or a GUI like DB Browser for SQLite. The table of interest is devices.

find /Applications/Xcode.app/Contents/Developer/Platforms -name 'device_traits.db' 2>/dev/null

Contributing

Always run the build task before committing, or use watch while making changes.

deno task build  # generate files
deno task watch  # watch for changes

To add a new class of devices, just add a new JSON file to the devices folder.

License

Since I'm probably not the only one who needs this, I'm releasing this to the public domain.

About

A best-effort compilation of all of Apple's device identifiers

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •