Latest 0.1.2
Homepage https://github.com/HiDaN4/DSDeviceKit
License MIT
Platforms ios 8.0
Authors

[![CI Status](http://img.shields.io/travis/Dmitry Sokolov/DSDeviceKit.svg?style=flat)](https://travis-ci.org/Dmitry Sokolov/DSDeviceKit)
Version
License
Platform

Overview

A wrapper for UIDevice that provides quick access to all necessary information about current Device. Implements the Singleton Pattern

Requirements

  • ARC
  • iOS 8 (dynamic framework)

Installation

DSDeviceKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "DSDeviceKit"

Usage

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
}

Example project

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Dmitry Sokolov

License

DSDeviceKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DSDeviceKit",
    "version": "0.1.2",
    "summary": "A wrapper for UIDevice that facilitates access to iOS Device info",
    "description": "This CocoaPod is a wrapper for UIDevice that provides a better way to get information about current device. Written in SwiftnnStatic instance of DSDeviceKit (currentDevice) has many properties, such as:nn- modelName     // "iPhone 6s"n- iOSVersion    // "9.3"n- deviceType    // .iPhone or .iPadn- identifier    // "iPhone8,1"n- isPhone       // true or falsen- isIpad        // true of falsen- orientation   // UIDeviceOrientationn- userInterface // UIUserInterfaceIdiom",
    "homepage": "https://github.com/HiDaN4/DSDeviceKit",
    "screenshots": "https://github.com/HiDaN4/DSDeviceKit/blob/master/DSDeviceKit.png?raw=true",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dmitry Sokolov": ""
    },
    "source": {
        "git": "https://github.com/HiDaN4/DSDeviceKit.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DSDeviceKit/Classes/**/*"
}

Pin It on Pinterest

Share This