talira

Detect the current Apple device model and screen size in Swift

open sourceMITfree

Device is a lightweight Swift library that tells an app which device it's running on: the iPhone, iPad or Mac model, its screen size, its device type, whether it has a Dynamic Island or a Retina display, and, when asked, which hardware a simulator is emulating.

Problems it solves

  • find out which iPhone model my Swift app is running on
  • adjust my iOS layout for small or large screen sizes
  • check whether the device has a Dynamic Island

Features

  • iPhone, iPad and Mac model detection
  • screen size detection with comparisons
  • Dynamic Island and Retina checks
  • simulated hardware detection in the simulator
  • no data collection, so no privacy manifest needed

Alternatives

The same job

These do what Device does.

  1. DeviceKit Value-type replacement for UIDevice: device model, battery, screen and sensors in Swift
  2. SDVersion Detect the Apple device model, screen size and OS version in Swift or Objective-C

Compare Device with the top 3