Skip to content

Commit

Permalink
Added new iPhones ️⃣s ⚡️
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Dobrincu authored and Sebastian Dobrincu committed Sep 19, 2016
1 parent 0b47a64 commit 53719b5
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 64 deletions.
20 changes: 11 additions & 9 deletions README.md
Expand Up @@ -37,28 +37,28 @@ SDVersion supports iOS, watchOS, tvOS, and macOS. Browse through the implementat
```objective-c

// Check for device model
if ([SDVersion deviceVersion] == iPhone6S)
NSLog(@"You got the iPhone 6S. Sweet 🍭!");
else if ([SDVersion deviceVersion] == iPhone6Plus)
NSLog(@"iPhone 6 Plus? Bigger is better!");
if ([SDVersion deviceVersion] == iPhone7)
NSLog(@"You got the iPhone 7. Sweet 🍭!");
else if ([SDVersion deviceVersion] == iPhone6SPlus)
NSLog(@"iPhone 6S Plus? Bigger is better!");
else if ([SDVersion deviceVersion] == iPadPro)
NSLog(@"You own an iPad Pro 🌀!");

// Check for device screen size
if ([SDVersion deviceSize] == Screen4inch)
NSLog(@"Your screen is 4 inches");
if ([SDVersion deviceSize] == Screen4Dot7inch)
NSLog(@"Your screen is 4.7 inches");

// Check if screen is in zoom mode
if ([SDVersion isZoomed])
NSLog(@"Your device is in Zoom Mode 🔎");

// Get device name
NSLog(@"%@", DeviceVersionNames[[SDVersion deviceVersion]]);
/* e.g: Outputs 'iPhone 6S Plus' */
/* e.g: Outputs 'iPhone 7 Plus' */

// Check for iOS Version
if (iOSVersionGreaterThanOrEqual(@"9"))
NSLog(@"You are running iOS 9 or above!");
if (iOSVersionGreaterThanOrEqual(@"10"))
NSLog(@"You are running iOS 10 or above!");

```

Expand Down Expand Up @@ -109,6 +109,8 @@ CocoaPods is a dependency manager for Objective-C, which automates and simplifie
iPhone6S
iPhone6SPlus
iPhoneSE
iPhone7
iPhone7Plus

iPad1
iPad2
Expand Down
4 changes: 2 additions & 2 deletions SDVersion-Demo/SDVersion.xcodeproj/project.pbxproj
Expand Up @@ -1036,7 +1036,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
IBSC_WARNINGS = YES;
INFOPLIST_FILE = SDiOSVersion/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.dobrincusebastian.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1052,7 +1052,7 @@
CODE_SIGN_IDENTITY = "";
IBSC_WARNINGS = YES;
INFOPLIST_FILE = SDiOSVersion/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.dobrincusebastian.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
48 changes: 26 additions & 22 deletions SDVersion-Demo/SDVersion/SDiOSVersion.h
Expand Up @@ -20,27 +20,29 @@ typedef NS_ENUM(NSInteger, DeviceVersion){
iPhone6Plus = 9,
iPhone6S = 10,
iPhone6SPlus = 11,
iPhoneSE = 12,
iPhone7 = 12,
iPhone7Plus = 13,
iPhoneSE = 14,

iPad1 = 13,
iPad2 = 14,
iPadMini = 15,
iPad3 = 16,
iPad4 = 17,
iPadAir = 18,
iPadMini2 = 19,
iPadAir2 = 20,
iPadMini3 = 21,
iPadMini4 = 22,
iPadPro12Dot9Inch = 23,
iPadPro9Dot7Inch = 24,
iPad1 = 15,
iPad2 = 16,
iPadMini = 17,
iPad3 = 18,
iPad4 = 19,
iPadAir = 20,
iPadMini2 = 21,
iPadAir2 = 22,
iPadMini3 = 23,
iPadMini4 = 24,
iPadPro12Dot9Inch = 25,
iPadPro9Dot7Inch = 26,

iPodTouch1Gen = 25,
iPodTouch2Gen = 26,
iPodTouch3Gen = 27,
iPodTouch4Gen = 28,
iPodTouch5Gen = 29,
iPodTouch6Gen = 30,
iPodTouch1Gen = 27,
iPodTouch2Gen = 28,
iPodTouch3Gen = 29,
iPodTouch4Gen = 30,
iPodTouch5Gen = 31,
iPodTouch6Gen = 32,

Simulator = 0
};
Expand All @@ -55,8 +57,10 @@ static NSString *DeviceVersionNames[] = {
[iPhone6Plus] = @"iPhone 6 Plus",
[iPhone6S] = @"iPhone 6S",
[iPhone6SPlus] = @"iPhone 6S Plus",
[iPhone7] = @"iPhone 7",
[iPhone7Plus] = @"iPhone 7 Plus",
[iPhoneSE] = @"iPhone SE",

[iPad1] = @"iPad 1",
[iPad2] = @"iPad 2",
[iPadMini] = @"iPad Mini",
Expand All @@ -69,14 +73,14 @@ static NSString *DeviceVersionNames[] = {
[iPadMini4] = @"iPad Mini 4",
[iPadPro9Dot7Inch] = @"iPad Pro",
[iPadPro12Dot9Inch] = @"iPad Pro",

[iPodTouch1Gen] = @"iPod Touch 1st Gen",
[iPodTouch2Gen] = @"iPod Touch 2nd Gen",
[iPodTouch3Gen] = @"iPod Touch 3rd Gen",
[iPodTouch4Gen] = @"iPod Touch 4th Gen",
[iPodTouch5Gen] = @"iPod Touch 5th Gen",
[iPodTouch6Gen] = @"iPod Touch 6th Gen",

[Simulator] = @"Simulator"
};

Expand Down
4 changes: 4 additions & 0 deletions SDVersion-Demo/SDVersion/SDiOSVersion.m
Expand Up @@ -35,6 +35,10 @@ + (NSDictionary*)deviceNamesByCode
@"iPhone8,1" : @(iPhone6S),
@"iPhone8,2" : @(iPhone6SPlus),
@"iPhone8,4" : @(iPhoneSE),
@"iPhone9,1" : @(iPhone7),
@"iPhone9,3" : @(iPhone7),
@"iPhone9,2" : @(iPhone7Plus),
@"iPhone9,4" : @(iPhone7Plus),
@"i386" : @(Simulator),
@"x86_64" : @(Simulator),

Expand Down
16 changes: 8 additions & 8 deletions SDVersion-Demo/SDiOSVersion/ViewController.m
Expand Up @@ -20,10 +20,10 @@ - (void)viewDidLoad {
self.iphoneSizeLabel.text = [self.iphoneSizeLabel.text stringByAppendingString:[NSString stringWithFormat:@"%@", DeviceSizeNames[[SDiOSVersion deviceSize]]]];

// Check for device model
if ([SDiOSVersion deviceVersion] == iPhone6)
NSLog(@"You got the iPhone 6. Nice!");
else if ([SDiOSVersion deviceVersion] == iPhone5S)
NSLog(@"You got the iPhone 5S. Good device!");
if ([SDiOSVersion deviceVersion] == iPhone7)
NSLog(@"You got the iPhone 7. Nice!");
else if ([SDiOSVersion deviceVersion] == iPhone6SPlus)
NSLog(@"You got the iPhone 6S Plus. Awesome device!");
else if ([SDiOSVersion deviceVersion] == iPodTouch6Gen)
NSLog(@"The latest iPod Touch. Cool! ❄️");

Expand All @@ -42,10 +42,10 @@ - (void)viewDidLoad {
}

//Check for iOS Version
if (iOSVersionGreaterThanOrEqualTo(@"9"))
NSLog(@"You are running iOS 9️⃣ or above!");
else if (iOSVersionLessThanOrEqualTo(@"8.4"))
NSLog(@"You're on iOS 8.4 or below! ⏳");
if (iOSVersionGreaterThanOrEqualTo(@"10"))
NSLog(@"You are running iOS 1️⃣0️⃣ or above!");
else if (iOSVersionLessThanOrEqualTo(@"9.1"))
NSLog(@"You're on iOS 9.1 or below! ⏳");
}


Expand Down
2 changes: 1 addition & 1 deletion SDVersion.podspec
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
#

s.name = "SDVersion"
s.version = "3.5"
s.version = "3.6"
s.summary = "Objective-C library for detecting running device model and screen size."
s.homepage = "https://github.com/sebyddd/SDVersion"
s.screenshots = "https://dl.dropboxusercontent.com/s/bmfjwfe2ngnivwn/sdversion.png?dl=0"
Expand Down
48 changes: 26 additions & 22 deletions SDVersion/SDiOSVersion/SDiOSVersion.h
Expand Up @@ -20,27 +20,29 @@ typedef NS_ENUM(NSInteger, DeviceVersion){
iPhone6Plus = 9,
iPhone6S = 10,
iPhone6SPlus = 11,
iPhoneSE = 12,
iPhone7 = 12,
iPhone7Plus = 13,
iPhoneSE = 14,

iPad1 = 13,
iPad2 = 14,
iPadMini = 15,
iPad3 = 16,
iPad4 = 17,
iPadAir = 18,
iPadMini2 = 19,
iPadAir2 = 20,
iPadMini3 = 21,
iPadMini4 = 22,
iPadPro12Dot9Inch = 23,
iPadPro9Dot7Inch = 24,
iPad1 = 15,
iPad2 = 16,
iPadMini = 17,
iPad3 = 18,
iPad4 = 19,
iPadAir = 20,
iPadMini2 = 21,
iPadAir2 = 22,
iPadMini3 = 23,
iPadMini4 = 24,
iPadPro12Dot9Inch = 25,
iPadPro9Dot7Inch = 26,

iPodTouch1Gen = 25,
iPodTouch2Gen = 26,
iPodTouch3Gen = 27,
iPodTouch4Gen = 28,
iPodTouch5Gen = 29,
iPodTouch6Gen = 30,
iPodTouch1Gen = 27,
iPodTouch2Gen = 28,
iPodTouch3Gen = 29,
iPodTouch4Gen = 30,
iPodTouch5Gen = 31,
iPodTouch6Gen = 32,

Simulator = 0
};
Expand All @@ -55,8 +57,10 @@ static NSString *DeviceVersionNames[] = {
[iPhone6Plus] = @"iPhone 6 Plus",
[iPhone6S] = @"iPhone 6S",
[iPhone6SPlus] = @"iPhone 6S Plus",
[iPhone7] = @"iPhone 7",
[iPhone7Plus] = @"iPhone 7 Plus",
[iPhoneSE] = @"iPhone SE",

[iPad1] = @"iPad 1",
[iPad2] = @"iPad 2",
[iPadMini] = @"iPad Mini",
Expand All @@ -69,14 +73,14 @@ static NSString *DeviceVersionNames[] = {
[iPadMini4] = @"iPad Mini 4",
[iPadPro9Dot7Inch] = @"iPad Pro",
[iPadPro12Dot9Inch] = @"iPad Pro",

[iPodTouch1Gen] = @"iPod Touch 1st Gen",
[iPodTouch2Gen] = @"iPod Touch 2nd Gen",
[iPodTouch3Gen] = @"iPod Touch 3rd Gen",
[iPodTouch4Gen] = @"iPod Touch 4th Gen",
[iPodTouch5Gen] = @"iPod Touch 5th Gen",
[iPodTouch6Gen] = @"iPod Touch 6th Gen",

[Simulator] = @"Simulator"
};

Expand Down
4 changes: 4 additions & 0 deletions SDVersion/SDiOSVersion/SDiOSVersion.m
Expand Up @@ -35,6 +35,10 @@ + (NSDictionary*)deviceNamesByCode
@"iPhone8,1" : @(iPhone6S),
@"iPhone8,2" : @(iPhone6SPlus),
@"iPhone8,4" : @(iPhoneSE),
@"iPhone9,1" : @(iPhone7),
@"iPhone9,3" : @(iPhone7),
@"iPhone9,2" : @(iPhone7Plus),
@"iPhone9,4" : @(iPhone7Plus),
@"i386" : @(Simulator),
@"x86_64" : @(Simulator),

Expand Down

0 comments on commit 53719b5

Please sign in to comment.