TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2015 |
Maintained by Sebastian Dobrincu.
Objective-C library for detecting the running device's model and screen size.
With the new iPhone models, developers have a little more work to do. This library simplifies their job by allowing them to get information about the running device and easily target the ones they want.
NEW: Now supports iPads and iOS Version Finder as well! Check them out bellow!
// Check for device model
if ([SDiPhoneVersion deviceVersion] == iPhone6)
NSLog(@"You got the new iPhone 6. Nice!");
else if ([SDiPhoneVersion deviceVersion] == iPhone6Plus)
NSLog(@"You got the iPhone 6 Plus. Bigger is better!");
else if ([SDiPhoneVersion deviceVersion] == iPadAir)
NSLog(@"You own an iPad Air!");
// Check for device screen size
if ([SDiPhoneVersion deviceSize] == iPhone4inch)
NSLog(@"Your screen is 4 inches");
// Get device name
NSLog(@"%@",[SDiPhoneVersion deviceName]);
/* e.g: Outputs 'iPhone6,2' */
// Check for iOS Version
if (iOSVersionGreaterThan(@"8"))
NSLog(@"You are running iOS 8 or above!");
There are 2 ways you can add SDiPhoneVersion to your project:
Simply import the 'SDiPhoneVersion' into your project then import the following in the class you want to use it:
#import "SDiPhoneVersion.h"
platform :ios, '5.0'
pod "SDiPhoneVersion", "~> "1.1.1"
+(DeviceVersion)deviceVersion;
+(DeviceSize)deviceSize;
+(NSString*)deviceName;
iPhone4
iPhone4S
iPhone5
iPhone5C
iPhone5S
iPhone6
iPhone6Plus
iPad1
iPad2
iPadMini
iPad3
iPad4
iPadAir
iPadMiniRetina
Simulator
iPhone35inch
iPhone4inch
iPhone47inch
iPhone55inch
iOSVersionEqualTo(@"V") //E.g: iOSVersionEqualTo(@"8.0.1")
iOSVersionGreaterThan(@"V")
iOSVersionGreaterThanOrEqualTo(@"V")
iOSVersionLessThan(@"V")
iOSVersionLessThanOrEqualTo(@"V")
Usage is provided under the MIT License. See LICENSE for the full details.