Skip to content

Commit 55b7539

Browse files
committed
Release 2.2
1 parent 50d00f3 commit 55b7539

File tree

20 files changed

+187
-185
lines changed

20 files changed

+187
-185
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SDVersion supports both iOS and Mac OS. Browse through the implementation of eac
3636
NSLog(@"You own an iPad Air 2 🌀!");
3737

3838
// Check for device screen size
39-
if ([SDVersion deviceSize] == iPhone4inch)
39+
if ([SDVersion deviceSize] == Screen4inch)
4040
NSLog(@"Your screen is 4 inches");
4141

4242
// Get device name
@@ -96,13 +96,20 @@ CocoaPods is a dependency manager for Objective-C, which automates and simplifie
9696
iPadAir2
9797
iPadMini3
9898

99+
iPodTouch1Gen
100+
iPodTouch2Gen
101+
iPodTouch3Gen
102+
iPodTouch4Gen
103+
iPodTouch5Gen
104+
iPodTouch6Gen
105+
99106
Simulator
100107

101108
### Targetable screen sizes
102-
iPhone3Dot5inch
103-
iPhone4inch
104-
iPhone4Dot7inch
105-
iPhone5Dot5inch
109+
Screen3Dot5inch
110+
Screen4inch
111+
Screen4Dot7inch
112+
Screen5Dot5inch
106113

107114
### Available iOS Version Finder methods
108115
iOSVersionEqualTo(@"v") //E.g: iOSVersionEqualTo(@"8.4.1")

SDVersion-Demo/SDiPhoneVersion.xcodeproj/project.pbxproj renamed to SDVersion-Demo/SDVersion.xcodeproj/project.pbxproj

Lines changed: 93 additions & 109 deletions
Large diffs are not rendered by default.

SDVersion-Demo/SDiPhoneVersion.xcodeproj/project.xcworkspace/contents.xcworkspacedata renamed to SDVersion-Demo/SDVersion.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SDVersion-Demo/SDVersion/SDVersion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#define SDVersion_h
1010

1111
#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE)
12-
#import "SDiPhoneVersion.h"
13-
#define SDVersion SDiPhoneVersion
12+
#import "SDiOSVersion.h"
13+
#define SDVersion SDiOSVersion
1414
#else
1515
#import "SDMacVersion.h"
1616
#define SDVersion SDMacVersion

SDVersion-Demo/SDVersion/SDiPhoneVersion.h renamed to SDVersion-Demo/SDVersion/SDiOSVersion.h

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SDiPhoneVersion.h
2+
// SDiOSVersion.h
33
// SDVersion
44
//
55
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
@@ -10,10 +10,10 @@
1010
#import <UIKit/UIKit.h>
1111
#import <sys/utsname.h>
1212

13-
#define stringFromDeviceVersion(v) [@{@(3):@"iPhone 4", @(4):@"iPhone 4S", @(5):@"iPhone 5", @(6):@"iPhone 5C", @(7):@"iPhone 5S", @(8):@"iPhone 6", @(9): @"iPhone 6 Plus", @(10):@"iPad 1", @(11):@"iPad 2", @(12):@"iPad Mini", @(13):@"iPad 3", @(14):@"iPad 4", @(15):@"iPad Air", @(16):@"iPad Mini 2", @(17):@"iPad Air 2", @(18):@"iPad Mini 3", @(0):@"Simulator"} objectForKey:[NSNumber numberWithInteger:v]]
13+
#define stringFromDeviceVersion(v) [@{@(3):@"iPhone 4", @(4):@"iPhone 4S", @(5):@"iPhone 5", @(6):@"iPhone 5C", @(7):@"iPhone 5S", @(8):@"iPhone 6", @(9): @"iPhone 6 Plus", @(10):@"iPad 1", @(11):@"iPad 2", @(12):@"iPad Mini", @(13):@"iPad 3", @(14):@"iPad 4", @(15):@"iPad Air", @(16):@"iPad Mini 2", @(17):@"iPad Air 2", @(18):@"iPad Mini 3", @(19):@"iPod Touch 1st Gen", @(20):@"iPod Touch 2nd Gen", @(21):@"iPod Touch 3rd Gen", @(22):@"iPod Touch 4th Gen", @(23):@"iPod Touch 5th Gen", @(24):@"iPod Touch 6th Gen", @(0):@"Simulator"} objectForKey:[NSNumber numberWithInteger:v]]
1414
#define stringFromDeviceSize(v) [@{@(0):@"Unknown Size", @(1):@"3.5 inch", @(2):@"4 inch", @(3):@"4.7 inch", @(4):@"5.5 inch"} objectForKey:[NSNumber numberWithInteger:v]]
1515

16-
@interface SDiPhoneVersion : NSObject
16+
@interface SDiOSVersion : NSObject
1717

1818
#define iOSVersionEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
1919
#define iOSVersionGreaterThan(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
@@ -22,32 +22,40 @@
2222
#define iOSVersionLessThanOrEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
2323

2424
typedef NS_ENUM(NSInteger, DeviceVersion){
25-
iPhone4 = 3,
26-
iPhone4S = 4,
27-
iPhone5 = 5,
28-
iPhone5C = 6,
29-
iPhone5S = 7,
30-
iPhone6 = 8,
31-
iPhone6Plus = 9,
32-
33-
iPad1 = 10,
34-
iPad2 = 11,
35-
iPadMini = 12,
36-
iPad3 = 13,
37-
iPad4 = 14,
38-
iPadAir = 15,
39-
iPadMini2 = 16,
40-
iPadAir2 = 17,
41-
iPadMini3 = 18,
42-
Simulator = 0
25+
iPhone4 = 3,
26+
iPhone4S = 4,
27+
iPhone5 = 5,
28+
iPhone5C = 6,
29+
iPhone5S = 7,
30+
iPhone6 = 8,
31+
iPhone6Plus = 9,
32+
33+
iPad1 = 10,
34+
iPad2 = 11,
35+
iPadMini = 12,
36+
iPad3 = 13,
37+
iPad4 = 14,
38+
iPadAir = 15,
39+
iPadMini2 = 16,
40+
iPadAir2 = 17,
41+
iPadMini3 = 18,
42+
43+
iPodTouch1Gen = 19,
44+
iPodTouch2Gen = 20,
45+
iPodTouch3Gen = 21,
46+
iPodTouch4Gen = 22,
47+
iPodTouch5Gen = 23,
48+
iPodTouch6Gen = 24,
49+
50+
Simulator = 0
4351
};
4452

4553
typedef NS_ENUM(NSInteger, DeviceSize){
46-
UnknownSize = 0,
47-
iPhone3Dot5inch = 1,
48-
iPhone4inch = 2,
49-
iPhone4Dot7inch = 3,
50-
iPhone5Dot5inch = 4
54+
UnknownSize = 0,
55+
Screen3Dot5inch = 1,
56+
Screen4inch = 2,
57+
Screen4Dot7inch = 3,
58+
Screen5Dot5inch = 4
5159
};
5260

5361
+(DeviceVersion)deviceVersion;

SDVersion-Demo/SDVersion/SDiPhoneVersion.m renamed to SDVersion-Demo/SDVersion/SDiOSVersion.m

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//
2-
// SDiPhoneVersion.m
2+
// SDiOSVersion.m
33
// SDVersion
44
//
5-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
66
//
77

8-
#import "SDiPhoneVersion.h"
8+
#import "SDiOSVersion.h"
99

10-
@implementation SDiPhoneVersion
10+
@implementation SDiOSVersion
1111

1212
+(NSDictionary*)deviceNamesByCode {
1313

@@ -61,7 +61,14 @@ +(NSDictionary*)deviceNamesByCode {
6161
@"iPad5,3" :[NSNumber numberWithInteger:iPadAir2],
6262
@"iPad5,4" :[NSNumber numberWithInteger:iPadAir2],
6363

64-
64+
//iPods
65+
@"iPod1,1" :[NSNumber numberWithInteger:iPodTouch1Gen],
66+
@"iPod2,1" :[NSNumber numberWithInteger:iPodTouch2Gen],
67+
@"iPod3,1" :[NSNumber numberWithInteger:iPodTouch3Gen],
68+
@"iPod4,1" :[NSNumber numberWithInteger:iPodTouch4Gen],
69+
@"iPod5,1" :[NSNumber numberWithInteger:iPodTouch5Gen],
70+
@"iPod7,1" :[NSNumber numberWithInteger:iPodTouch6Gen]
71+
6572
};
6673
});
6774

@@ -82,7 +89,7 @@ +(DeviceVersion)deviceVersion {
8289
+(DeviceSize)deviceSize {
8390

8491
CGFloat screenHeight = 0;
85-
92+
8693
if (iOSVersionGreaterThan(@"8")) {
8794

8895
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
@@ -95,14 +102,14 @@ +(DeviceSize)deviceSize {
95102
screenHeight = [[UIScreen mainScreen] bounds].size.height;
96103

97104
if (screenHeight == 480)
98-
return iPhone3Dot5inch;
105+
return Screen3Dot5inch;
99106
else if(screenHeight == 568)
100-
return iPhone4inch;
107+
return Screen4inch;
101108
else if(screenHeight == 667){
102-
if ([UIScreen mainScreen].scale > 2.9) return iPhone5Dot5inch;
103-
return iPhone4Dot7inch;
109+
if ([UIScreen mainScreen].scale > 2.9) return Screen5Dot5inch;
110+
return Screen4Dot7inch;
104111
}else if(screenHeight == 736)
105-
return iPhone5Dot5inch;
112+
return Screen5Dot5inch;
106113
else
107114
return UnknownSize;
108115
}

SDVersion-Demo/SDiPhoneVersion/AppDelegate.h renamed to SDVersion-Demo/SDiOSVersion/AppDelegate.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// AppDelegate.h
3-
// SDiPhoneVersion
3+
// SDiOSVersion
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import <UIKit/UIKit.h>

SDVersion-Demo/SDiPhoneVersion/AppDelegate.m renamed to SDVersion-Demo/SDiOSVersion/AppDelegate.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// AppDelegate.m
3-
// SDiPhoneVersion
3+
// SDiOSVersion
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import "AppDelegate.h"

SDVersion-Demo/SDiPhoneVersion/ViewController.h renamed to SDVersion-Demo/SDiOSVersion/ViewController.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// ViewController.h
3-
// SDiPhoneVersion
3+
// SDiOSVersion
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import <UIKit/UIKit.h>

SDVersion-Demo/SDiPhoneVersion/ViewController.m renamed to SDVersion-Demo/SDiOSVersion/ViewController.m

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// ViewController.m
3-
// SDiPhoneVersion
3+
// SDiOSVersion
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import "ViewController.h"
@@ -15,25 +14,27 @@ - (void)viewDidLoad {
1514
[super viewDidLoad];
1615

1716
// Get device name as NSString
18-
self.iphoneVersionLabel.text = [self.iphoneVersionLabel.text stringByAppendingString:stringFromDeviceVersion([SDVersion deviceVersion])];
17+
self.iphoneVersionLabel.text = [self.iphoneVersionLabel.text stringByAppendingString:stringFromDeviceVersion([SDiOSVersion deviceVersion])];
1918

2019
// Get device size using string conversion
21-
self.iphoneSizeLabel.text = [self.iphoneSizeLabel.text stringByAppendingString:[NSString stringWithFormat:@"%@", stringFromDeviceSize([SDVersion deviceSize])]];
20+
self.iphoneSizeLabel.text = [self.iphoneSizeLabel.text stringByAppendingString:[NSString stringWithFormat:@"%@", stringFromDeviceSize([SDiOSVersion deviceSize])]];
2221

2322
// Check for device model
24-
if ([SDVersion deviceVersion] == iPhone6)
23+
if ([SDiOSVersion deviceVersion] == iPhone6)
2524
NSLog(@"You got the iPhone 6. Nice!");
26-
else if ([SDVersion deviceVersion] == iPhone5S)
25+
else if ([SDiOSVersion deviceVersion] == iPhone5S)
2726
NSLog(@"You got the iPhone 5S. Good device!");
27+
else if ([SDiOSVersion deviceVersion] == iPodTouch6Gen)
28+
NSLog(@"The latest iPod Touch. Cool! ❄️")
2829

2930
// Check for device screen size
30-
if ([SDVersion deviceSize] == iPhone3Dot5inch)
31+
if ([SDiOSVersion deviceSize] == Screen3Dot5inch)
3132
NSLog(@"Your screen is 3.5 inches");
32-
else if ([SDVersion deviceSize] == iPhone4inch)
33+
else if ([SDiOSVersion deviceSize] == Screen4inch)
3334
NSLog(@"Your screen size is 4 inches");
34-
else if([SDVersion deviceSize] == iPhone4Dot7inch)
35+
else if([SDiOSVersion deviceSize] == Screen4Dot7inch)
3536
NSLog(@"Your screen size is 4.7 inches");
36-
else if([SDVersion deviceSize] == iPhone5Dot5inch)
37+
else if([SDiOSVersion deviceSize] == Screen5Dot5inch)
3738
NSLog(@"Your screen size is 5.5 inches");
3839

3940
//Check for iOS Version

SDVersion-Demo/SDiPhoneVersion/main.m renamed to SDVersion-Demo/SDiOSVersion/main.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// main.m
3-
// SDiPhoneVersion
3+
// SDiOSVersion
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import <UIKit/UIKit.h>

SDVersion-Demo/SDiPhoneVersionTests/SDiPhoneVersionTests.m renamed to SDVersion-Demo/SDiOSVersionTests/SDiOSVersionTests.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
//
2-
// SDiPhoneVersionTests.m
3-
// SDiPhoneVersionTests
2+
// SDiOSVersionTests.m
3+
// SDiOSVersionTests
44
//
5-
// Created by Sebastian Dobrincu on 10/09/14.
6-
// Copyright (c) 2014 Sebastian Dobrincu. All rights reserved.
5+
// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved.
76
//
87

98
#import <UIKit/UIKit.h>
109
#import <XCTest/XCTest.h>
1110

12-
@interface SDiPhoneVersionTests : XCTestCase
11+
@interface SDiOSVersionTests : XCTestCase
1312

1413
@end
1514

16-
@implementation SDiPhoneVersionTests
15+
@implementation SDiOSVersionTests
1716

1817
- (void)setUp {
1918
[super setUp];

SDVersion.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
88
#
99

1010
s.name = "SDVersion"
11-
s.version = "2.1.4"
11+
s.version = "2.2"
1212
s.summary = "Objective-C library for detecting running device model and screen size."
1313
s.homepage = "https://github.com/sebyddd/SDVersion"
1414
s.screenshots = "https://dl.dropboxusercontent.com/s/5ddx58dsex25x57/sdversion-logo.png?dl=0"
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
2828
s.platform = :osx
2929
s.ios.deployment_target = '7.0'
3030
s.osx.deployment_target = '10.9'
31-
s.ios.source_files = "SDVersion/SDiPhoneVersion/*.{h,m}"
31+
s.ios.source_files = "SDVersion/SDiOSVersion/*.{h,m}"
3232
s.osx.source_files = "SDVersion/SDMacVersion/*.{h,m}"
3333
s.source = { :git => 'https://github.com/sebyddd/SDVersion.git', :tag => "#{s.version}" }
3434
s.source_files = "SDVersion/*.{h,m}"

0 commit comments

Comments
 (0)