[![CI Status](http://img.shields.io/travis/Dmitry Sokolov/DSDeviceKit.svg?style=flat)](https://travis-ci.org/Dmitry Sokolov/DSDeviceKit)
A wrapper for UIDevice that provides quick access to all necessary information about current Device. Implements the Singleton Pattern
- ARC
- iOS 8 (dynamic framework)
DSDeviceKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DSDeviceKit"
import DSDeviceKit
let device = DSDeviceKit.currentDevice
print(device.modelName) // "iPhone 6s" or "iPad Air 2" and so on
print(device.identifier) // "iPhone8,1" or "Simulator" and so on
print(device.iOSVersion) // "9.3" and so on
print(device.deviceType) // "iPhone" or "iPad" or "iPod Touch" or "Unknown"
print(device.isPhone) // true or false
let devices = ["iphone 6", "ipad pro", "iPhone SE"]
if device.isOneOf(devices) {
// is one of the allowed devices
}
if device.deviceType == .iPodTouch { // or .iPhone or .iPad
// ...
}
// or you can use convenient computed variables:
if device.isPhone {
// this is iPhone
}
if device.isIPad {
// this is iPad
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
Dmitry Sokolov
DSDeviceKit is available under the MIT license. See the LICENSE file for more info.