explaingit

devicekit/devicekit

4,709SwiftAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A Swift library for iOS, tvOS, and watchOS that makes it simple to identify the exact Apple device model an app is running on and check hardware features like Face ID, screen size, battery level, and available storage.

Mindmap

mindmap
  root((devicekit))
    What it does
      Device identification
      Feature detection
      Simulator support
    Device types
      iPhone and iPad
      Apple TV
      Apple Watch
    Detectable features
      Face ID vs Touch ID
      Battery level
      Free storage
      Screen size
    Installation
      Swift Package Manager
      CocoaPods
      Carthage
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Enable or disable app features based on whether the user's device has Face ID or Touch ID.

USE CASE 2

Show device-specific UI adjustments for notched iPhones versus older flat-screen models.

USE CASE 3

Check if the app is running in the Xcode Simulator to skip hardware-only code paths during testing.

USE CASE 4

Read battery percentage and Low Power Mode status to pause background sync and save battery.

Tech stack

SwiftiOStvOSwatchOSSwift Package ManagerCocoaPods

Getting it running

Difficulty · easy Time to first run · 5min

Add via Swift Package Manager or CocoaPods, no external services or configuration needed.

Free to use for any purpose including commercial apps, as long as you include the MIT license notice in your project.

In plain English

DeviceKit is a Swift library for iOS, tvOS, and watchOS developers that makes it easy to identify what Apple device an app is running on and to read information about that device. It is a drop-in replacement for UIDevice, which is Apple's own built-in way of getting device information but has a less convenient API. The library lets you ask questions like: what exact iPhone model is this, is it a phone or a tablet, is it running in the iOS Simulator (the test environment Xcode uses on a Mac), what is the current battery percentage, is Low Power Mode on, how much free storage is available, does this device have Face ID or Touch ID, and what is the screen size. Each of these is exposed as a simple property or comparison rather than requiring multiple API calls. A common use case is checking whether the current device belongs to a specific group, for example to enable or disable features that only work on certain hardware. The library models every Apple device (iPhone, iPad, iPod, Apple TV, Apple Watch) as named enum values, so comparisons are written in plain Swift without magic strings or numeric codes. DeviceKit works alongside the Simulator: every real device model also has a simulator variant, so code that checks for a specific device continues to work correctly during testing. Model identifiers come from the iPhone Wiki, a publicly maintained reference for Apple hardware. The library is available via CocoaPods, Swift Package Manager, and Carthage (three common ways to add dependencies to an Apple platform project) and also supports manual installation. It requires iOS 11, tvOS 11, or watchOS 4 or later. It is open source under the MIT license.

Copy-paste prompts

Prompt 1
Using DeviceKit in Swift, write code to check if the current device supports Face ID and show a biometric login button only when it does.
Prompt 2
How do I use DeviceKit to detect whether my SwiftUI app is running on an iPad vs an iPhone and adjust the layout accordingly?
Prompt 3
Show me how to check available storage and battery percentage using DeviceKit and display them in a settings screen.
Prompt 4
How do I add DeviceKit to my iOS project using Swift Package Manager in Xcode?
Open on GitHub → Explain another repo

← devicekit on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.