Latest 0.1.0
Homepage https://github.com/npalamar/NPDevice
License MIT
Platforms ios 7.0, requires ARC
Authors

NPDevice

This is the simple class for comfortable working with iOS device models, such as iPhone 4, 4s, 5, 5c, 5s, 6, 6p, iPad. Model type of the device is based on its screen resolution

Overview

Device methods

For getting current device, just use this code:

DeviceModel model = [DeviceModel model];

You can also write something like this

if ([DeviceModel isEqualToModel:DeviceModelPhone5]) {
//  Your code here
}

Or this

if ([DeviceModel isIpad]) {
  NSLog(@"Is an iPad!");
}
if ([DeviceModel isIphone]) {
  NSLog(@"Is an iPhone!");
}

For getting current device orientaion use this methods

+ (BOOL)isLandscape;
+ (BOOL)isPortrait;

Devices list

DeviceModel enum contains the full list of supporting devices

typedef NS_ENUM(NSUInteger, DeviceModel) {
  DeviceModelUnknown,           // Unknown device
  DeviceModelPhone4,            // iPhone 4/4s
  DeviceModelPhone5,            // iPhone 5/5c/5s
  DeviceModelPhone6,            // iPhone 6
  DeviceModelPhone6p,           // iPhone 6 Plus
  DeviceModelPad                // iPads
};

Requirements

  • iOS 7 or later

CocoaPods

You can install this code via CocoaPods

pod 'NPDevice'

License

  • NPDevice is available under the MIT License. See the LICENSE.

Contact

If you have some advices or ideas, please send me an email:
[email protected]

Latest podspec

{
    "name": "NPDevice",
    "version": "0.1.0",
    "summary": "This is the simple class for comfortable working with device models, such as iPhone 4, 4s, 5, 5c, 5s, 6, 6p, iPad.",
    "homepage": "https://github.com/npalamar/NPDevice",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Nikolay Palamar": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/npalamar/NPDevice.git",
        "tag": "0.1.0"
    },
    "source_files": "*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This