DeviceKit is a Swift package that replaces UIDevice with a value-type API for reading device, battery, and system details.
Overview
DeviceKit is a value-type replacement for UIDevice. Swift developers import it to identify the hardware running an app, inspect device families, and detect simulator environments.
The library exposes helpers to read the current device, simulator device type, battery level and charging state, low-power mode, Guided Access status, screen brightness, and available disk space. Battery queries temporarily enable battery monitoring and restore the previous setting afterward.
Device model identifiers are taken from public reference lists and from simulator metadata bundled with Xcode. DeviceKit targets modern Swift branches and can be exercised in a playground after building the framework for a simulator.
It fits apps that need structured device checks without relying on UIDevice reference semantics, including logic that groups devices into predefined families for feature gating.
Key features
- Value-type device identification
- Device family and simulator detection
- Battery level and state queries
- Low power and Guided Access status
- Screen brightness access
- Available disk space reporting
- Preconfigured device group checks
Use cases
- Detecting iPhone and iPad models in Swift apps
- Adjusting behavior in the iOS Simulator
- Surfacing battery and power state in UI
- Gating features by device family