Skip to content

Commit

Permalink
Support Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cruisediary committed Oct 6, 2018
1 parent fedee68 commit cf57ae8
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Device/Device.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Device"
s.version = "3.1.0"
s.version = "3.1.2"
s.summary = "Light weight tool for detecting the current device and screen size written in swift."

s.description = "Swift library for detecting the running device's model and screen size. With the newer  devices, developers have 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."
Expand Down
19 changes: 12 additions & 7 deletions Carthage/Checkouts/Device/Device.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@
};
BE11EEE61BE3FC0300816835 = {
CreatedOnToolsVersion = 7.1;
DevelopmentTeam = B68QLRDMYT;
DevelopmentTeam = 9CWMR8UHTJ;
LastSwiftMigration = 0930;
ProvisioningStyle = Automatic;
};
E2C023A91D6331010033AD25 = {
CreatedOnToolsVersion = 7.3.1;
Expand Down Expand Up @@ -514,7 +515,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -536,7 +537,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -658,15 +659,17 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = B68QLRDMYT;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9CWMR8UHTJ;
INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -680,14 +683,16 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = B68QLRDMYT;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9CWMR8UHTJ;
INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
9 changes: 9 additions & 0 deletions Carthage/Checkouts/Device/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ class ViewController: UIViewController {
case .iPhoneSE: print("It's an iPhone SE")
case .iPhone7: print("It's an iPhone 7")
case .iPhone7Plus: print("It's an iPhone 7 Plus")
case .iPhone8: print("It's an iPhone 8")
case .iPhone8Plus: print("It's an iPhone 8 Plus")
case .iPhoneX: print("It's an iPhone X")
case .iPhoneXS: print("It's an iPhone Xs")
case .iPhoneXS_Max: print("It's an iPhone Xs Max")
case .iPhoneXR: print("It's an iPhone Xr")

/*** iPad ***/
case .iPad1: print("It's an iPad 1")
case .iPad2: print("It's an iPad 2")
case .iPad3: print("It's an iPad 3")
case .iPad4: print("It's an iPad 4")
case .iPad5: print("It's an iPad 5")
case .iPad6: print("It's an iPad 6")
case .iPadAir: print("It's an iPad Air")
case .iPadAir2: print("It's an iPad Air 2")
case .iPadMini: print("It's an iPad Mini")
Expand Down Expand Up @@ -68,6 +75,8 @@ class ViewController: UIViewController {
case .screen4_7Inch: print("It's a 4.7 inch screen")
case .screen5_5Inch: print("It's a 5.5 inch screen")
case .screen5_8Inch: print("It's a 5.8 inch screen")
case .screen6_1Inch: print("It's a 6.1 inch screen")
case .screen6_5Inch: print("It's a 6.8 inch screen")
case .screen7_9Inch: print("It's a 7.9 inch screen")
case .screen9_7Inch: print("It's a 9.7 inch screen")
case .screen10_5Inch: print("It's a 10.5 inch screen")
Expand Down
20 changes: 17 additions & 3 deletions Carthage/Checkouts/Device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Platform](https://img.shields.io/cocoapods/p/Device.svg?style=flat)](http://cocoapods.org/pods/Device)
![](https://img.shields.io/badge/Supported-iOS8%20%7C%20OSX%2010.10-4BC51D.svg?style=flat-square)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
![](https://img.shields.io/badge/Swift-3.0.2-orange.svg?style=flat)
![](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/LucasEkhoo)

Device detect the current  device model and screen size.
Expand All @@ -16,7 +16,7 @@ Device is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "Device", '~> 3.1.0'
pod "Device", '~> 3.1.2'
```

## Carthage
Expand All @@ -33,7 +33,7 @@ $ brew install carthage
To integrate Device into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "Ekhoo/Device" ~> 3.1.0
github "Ekhoo/Device" ~> 3.1.2
```

Run `carthage update` to build the framework and drag the built `Device.framework` into your Xcode project.
Expand All @@ -55,20 +55,31 @@ func myFunc() {
case .iPhone6S: print("It's an iPhone 6S")
case .iPhone6Plus: print("It's an iPhone 6 Plus")
case .iPhone6SPlus: print("It's an iPhone 6 S Plus")
case .iPhoneSE: print("It's an iPhone SE")
case .iPhone7: print("It's an iPhone 7")
case .iPhone7Plus: print("It's an iPhone 7 Plus")
case .iPhone8: print("It's an iPhone 8")
case .iPhone8Plus: print("It's an iPhone 8 Plus")
case .iPhoneX: print("It's an iPhone X")
case .iPhoneXS: print("It's an iPhone Xs")
case .iPhoneXS_Max: print("It's an iPhone Xs Max")
case .iPhoneXR: print("It's an iPhone Xr")

/*** iPad ***/
case .iPad1: print("It's an iPad 1")
case .iPad2: print("It's an iPad 2")
case .iPad3: print("It's an iPad 3")
case .iPad4: print("It's an iPad 4")
case .iPad5: print("It's an iPad 5")
case .iPad6: print("It's an iPad 6")
case .iPadAir: print("It's an iPad Air")
case .iPadAir2: print("It's an iPad Air 2")
case .iPadMini: print("It's an iPad Mini")
case .iPadMini2: print("It's an iPad Mini 2")
case .iPadMini3: print("It's an iPad Mini 3")
case .iPadMini4: print("It's an iPad Mini 4")
case .iPadPro9_7Inch: print("It's an iPad Pro 9.7 Inch")
case .iPadPro10_5Inch: print("It's an iPad Pro 10.5 Inch")
case .iPadPro12_9Inch: print("It's an iPad Pro 12.9 Inch")

/*** iPod ***/
Expand Down Expand Up @@ -98,8 +109,11 @@ func myFunc() {
case .screen4_7Inch: print("It's a 4.7 inch screen")
case .screen5_5Inch: print("It's a 5.5 inch screen")
case .screen5_8Inch: print("It's a 5.8 inch screen")
case .screen6_1Inch: print("It's a 6.1 inch screen")
case .screen6_5Inch: print("It's a 6.8 inch screen")
case .screen7_9Inch: print("It's a 7.9 inch screen")
case .screen9_7Inch: print("It's a 9.7 inch screen")
case .screen10_5Inch: print("It's a 10.5 inch screen")
case .screen12_9Inch: print("It's a 12.9 inch screen")
default: print("Unknown size")
}
Expand Down
13 changes: 13 additions & 0 deletions Carthage/Checkouts/Device/Source/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,27 @@
public enum Size: Int, Comparable {
case unknownSize = 0
#if os(iOS)
/// iPhone 4, 4s, iPod Touch 4th gen.
case screen3_5Inch
/// iPhone 5, 5s, 5c, SE, iPod Touch 5-6th gen.
case screen4Inch
/// iPhone 6, 6s, 7, 8
case screen4_7Inch
/// iPhone 6+, 6s+, 7+, 8+
case screen5_5Inch
/// iPhone X, Xs
case screen5_8Inch
/// iPhone Xr
case screen6_1Inch
/// iPhone Xs Max
case screen6_5Inch
/// iPad Mini
case screen7_9Inch
/// iPad
case screen9_7Inch
/// iPad Pro (10.5-inch)
case screen10_5Inch
/// iPad Pro (12.9-inch)
case screen12_9Inch
#elseif os(OSX)
case screen11Inch
Expand Down
4 changes: 4 additions & 0 deletions Carthage/Checkouts/Device/Source/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ public enum Version: String {
case iPhone8
case iPhone8Plus
case iPhoneX
case iPhoneXS
case iPhoneXS_Max
case iPhoneXR

/*** iPad ***/
case iPad1
case iPad2
case iPad3
case iPad4
case iPad5
case iPad6
case iPadAir
case iPadAir2
case iPadMini
Expand Down
8 changes: 5 additions & 3 deletions DeviceLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/usr/local/bin/carthage copy-frameworks";
shellScript = "/usr/local/bin/carthage copy-frameworks\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -308,6 +308,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -354,6 +355,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -380,7 +382,7 @@
PRODUCT_BUNDLE_IDENTIFIER = cruz.DeviceLayout;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -403,7 +405,7 @@
PRODUCT_BUNDLE_IDENTIFIER = cruz.DeviceLayout;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down

0 comments on commit cf57ae8

Please sign in to comment.