Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
16383c5
Add boolean and array functions to check if the device has a sensor h…
Zandor300 Feb 28, 2019
6bd7410
Move variables together.
Zandor300 Mar 3, 2019
8fc0c1f
Rename allDevicesWithASensorHousing to allDevicesWithSensorHousing.
Zandor300 Mar 4, 2019
eb4f624
Merge remote-tracking branch 'upstream/master'
Zandor300 Mar 4, 2019
3a8bd5e
Create allDevicesWithRoundedDisplayCorners and hasRoundedDisplayCorne…
Zandor300 Mar 4, 2019
60ecca4
Create branch for 2.0 changes.
Zandor300 Mar 4, 2019
3b5c2ad
Rename iPhone Xs to XS and Xr to XR (fixes https://github.com/dennisw…
Zandor300 Mar 4, 2019
374ff4e
Fixed generation of allDevicesWithSensorHousing and hasSensorHousing …
Zandor300 Mar 4, 2019
29d2090
Check if device is current.
Zandor300 Mar 4, 2019
7fd93ec
Fixed formatting.
Zandor300 Mar 4, 2019
7a5b4e9
Check for current device in isZoomed.
Zandor300 Mar 4, 2019
19cc90f
Add documentation to the isCurrent variable.
Zandor300 Mar 4, 2019
6d71f31
Add static current variable and make the initialiser private.
Zandor300 Mar 4, 2019
e72edc5
Revert commit used to create the patch branch in my fork.
Zandor300 Mar 4, 2019
fa65674
Fixed readme so that it also contains the rename of XS and XR.
Zandor300 Mar 4, 2019
f2145b8
Check for isCurrent on the isPhone and isPad variables when DeviceKit…
Zandor300 Mar 4, 2019
3297936
Change device description to use small caps on iPhone XS (Max) and iP…
Zandor300 Mar 5, 2019
d8b5102
Changed all if !isCurrent statements to guards.
Zandor300 Mar 5, 2019
05cac80
Remove .instance and the initialiser and completely move over to .cur…
Zandor300 Mar 5, 2019
463b708
Fixed names of iPad 3, 4, 5 and 6.
Zandor300 Mar 5, 2019
c834fe5
Fix https://github.com/dennisweissmann/DeviceKit/pull/166 not being a…
Zandor300 Mar 18, 2019
5458bb7
Fix documentation inside code to use Device.current instead of the co…
Zandor300 Mar 18, 2019
e43df4f
Fixed readme to use Device.current instead of the constructor.
Zandor300 Mar 18, 2019
3eec7cd
Add new iPad Air (3th generation) and iPad Mini (5th generation).
Zandor300 Mar 18, 2019
2a9728b
Revert https://github.com/Zandor300/DeviceKit/commit/3eec7cde1dc54da1…
Zandor300 Mar 18, 2019
e12017c
Update to Swift 5.
Zandor300 Mar 29, 2019
8f2c68f
Update tests for breaking changes.
Zandor300 Mar 29, 2019
ad09560
Merge branch 'master' into patch-1
Zandor300 Mar 29, 2019
d5afc04
Merge remote-tracking branch 'upstream/master' into patch-1
Zandor300 Mar 29, 2019
2326751
Fix merge.
Zandor300 Mar 29, 2019
9c342f6
Fixed code alignment.
Zandor300 Mar 29, 2019
149fc52
Fixed trailing whitespace violations.
Zandor300 Mar 29, 2019
93dcd67
Disable the function_body_length rule on mapToDevice(String).
Zandor300 Mar 29, 2019
123a950
Use Xcode 10.2 to build and test the project.
Zandor300 Mar 29, 2019
dbe45bd
Set .swift-version to 5.0
Zandor300 Mar 29, 2019
a0601cd
Fixed description tests.
Zandor300 Mar 30, 2019
e8448b9
Add iPad (6th gen), iPad Air (3rd gen) and iPad Mini (5th gen) to the…
Zandor300 Mar 30, 2019
1a8610f
Merge branch 'patch-1' of https://github.com/Zandor300/DeviceKit into…
Zandor300 Mar 30, 2019
416e764
Fixed one test that still used Device().
Zandor300 Mar 30, 2019
3526e3f
Created new test to prevent https://github.com/devicekit/DeviceKit/is…
Zandor300 Mar 30, 2019
42395a1
Merge branch 'master' into patch-1
Zandor300 Mar 30, 2019
5689963
Disable the function_body_length swiftlint rule on the testDescriptio…
Zandor300 Mar 30, 2019
ea46929
Added a bunch of tech specs and image links where missing.
Zandor300 Mar 30, 2019
3667112
Fixed spacing and another couple urls.
Zandor300 Mar 30, 2019
c2a10c3
Add Swift 5 information to the readme.
Zandor300 Apr 1, 2019
11353eb
Add a default case to the switch to cover future additions to WKInter…
Zandor300 Apr 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.0
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode10.1
osx_image: xcode10.2

env:
- DESTINATION='platform=iOS Simulator,name=iPad (5th generation)'
Expand Down
13 changes: 7 additions & 6 deletions DeviceKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@
};
955EE5991D5E581B008C3DA8 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
955EE5A11D5E581B008C3DA8 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand All @@ -225,6 +225,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 95CBDB631BFD2B440065FC66;
Expand Down Expand Up @@ -384,7 +385,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -437,7 +438,7 @@
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
Expand Down Expand Up @@ -489,7 +490,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -530,7 +531,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
| Branch | Build Status | Versions |
|:---------|:--------------:|:----------:|
| **master** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=master)](https://travis-ci.org/devicekit/DeviceKit)| - |
| **Swift 4 - 4.2** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-4)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.3 |
| **Swift 5** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-5)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 2.0 |
| **Swift 4 - 4.2** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-4)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.3 < 1.13 |
| **Swift 3** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-3)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.0 < 1.3 |
| **Swift 2.3** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-2.3-unsupported)](https://travis-ci.org/devicekit/DeviceKit)| < 1.0 |

Expand Down Expand Up @@ -47,6 +48,10 @@ DeviceKit can be installed in various ways.

### CocoaPods

#### Swift 5
```ruby
pod 'DeviceKit', '~> 2.0'
```
#### Swift 4.0 - Swift 4.2
```ruby
pod 'DeviceKit', '~> 1.3'
Expand All @@ -62,6 +67,10 @@ pod 'DeviceKit', :git => 'https://github.com/devicekit/DeviceKit.git', :branch =

### Carthage

#### Swift 5
```ogdl
github "devicekit/DeviceKit" ~> 2.0
```
#### Swift 4.0 - Swift 4.2
```ogdl
github "devicekit/DeviceKit" ~> 1.3
Expand Down Expand Up @@ -101,7 +110,7 @@ You can try these examples in Playground.

### Get the Device You're Running On
```swift
let device = Device()
let device = Device.current

print(device) // prints, for example, "iPhone 6 Plus"

Expand All @@ -114,7 +123,7 @@ if device == .iPhone6Plus {

### Get the Device Family
```swift
let device = Device()
let device = Device.current
if device.isPod {
// iPods (real or simulator)
} else if device.isPhone {
Expand All @@ -126,7 +135,7 @@ if device.isPod {

### Check If Running on Simulator
```swift
let device = Device()
let device = Device.current
if device.isSimulator {
// Running on one of the simulators(iPod/iPhone/iPad)
// Skip doing something irrelevant for Simulator
Expand All @@ -135,7 +144,7 @@ if device.isSimulator {

### Get the Simulator Device
```swift
let device = Device()
let device = Device.current
switch device {
case .simulator(.iPhone6s): break // You're running on the iPhone 6s simulator
case .simulator(.iPadAir2): break // You're running on the iPad Air 2 simulator
Expand All @@ -145,9 +154,9 @@ default: break

### Make Sure the Device Is Contained in a Preconfigured Group
```swift
let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXs),.simulator(.iPhoneXsMax),.simulator(.iPhoneXr)]
let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXS),.simulator(.iPhoneXSMax),.simulator(.iPhoneXR)]

let device = Device()
let device = Device.current

if device.isOneOf(groupOfAllowedDevices) {
// Do your action
Expand Down
Loading