Skip to content

Commit 5468e9d

Browse files
Fix warnings and bump to Swift 5
1 parent 7baefc4 commit 5468e9d

File tree

7 files changed

+16
-19
lines changed

7 files changed

+16
-19
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0
1+
5.0

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: swift
2+
osx_image: xcode10.2
23
script:
34
- set -o pipefail
45
- swift --version
@@ -9,4 +10,4 @@ script:
910
- xcodebuild clean build test -project DeviceIdentificator.xcodeproj -scheme DeviceIdentificator-tvOS -destination "platform=tvOS Simulator,name=Apple TV" | xcpretty -f `xcpretty-travis-formatter`
1011
- bash <(curl -s https://codecov.io/bash) -cF tvOS -J 'DeviceIdentificator'
1112
- swiftlint lint
12-
- pod lib lint
13+
- pod lib lint

DeviceIdentificator.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Pod::Spec.new do |s|
99
DESC
1010
s.homepage = "https://github.com/sebastianvarela/DeviceIdentificator"
1111
s.license = { :type => "MIT", :file => "LICENSE" }
12+
s.swift_version = '5.0'
1213

1314
s.author = { "Sebastián Varela" => "[email protected]" }
1415
s.social_media_url = "http://twitter.com/skirmish84"

DeviceIdentificator.xcodeproj/project.pbxproj

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
hasScannedForEncodings = 0;
276276
knownRegions = (
277277
en,
278+
Base,
278279
);
279280
mainGroup = E2A364EC200D104900668DF9;
280281
productRefGroup = E2A364F7200D104900668DF9 /* Products */;
@@ -428,7 +429,6 @@
428429
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificator;
429430
SDKROOT = appletvos;
430431
SKIP_INSTALL = YES;
431-
SWIFT_VERSION = 4.0;
432432
TARGETED_DEVICE_FAMILY = 3;
433433
TVOS_DEPLOYMENT_TARGET = 10.1;
434434
};
@@ -450,7 +450,6 @@
450450
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificator;
451451
SDKROOT = appletvos;
452452
SKIP_INSTALL = YES;
453-
SWIFT_VERSION = 4.0;
454453
TARGETED_DEVICE_FAMILY = 3;
455454
TVOS_DEPLOYMENT_TARGET = 10.1;
456455
};
@@ -467,7 +466,6 @@
467466
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificatorTests;
468467
PRODUCT_NAME = "$(TARGET_NAME)";
469468
SDKROOT = appletvos;
470-
SWIFT_VERSION = 4.0;
471469
TARGETED_DEVICE_FAMILY = 3;
472470
TVOS_DEPLOYMENT_TARGET = 11.4;
473471
};
@@ -484,7 +482,6 @@
484482
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificatorTests;
485483
PRODUCT_NAME = "$(TARGET_NAME)";
486484
SDKROOT = appletvos;
487-
SWIFT_VERSION = 4.0;
488485
TARGETED_DEVICE_FAMILY = 3;
489486
TVOS_DEPLOYMENT_TARGET = 11.4;
490487
};
@@ -502,7 +499,6 @@
502499
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
503500
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificatorTests;
504501
PRODUCT_NAME = "$(TARGET_NAME)";
505-
SWIFT_VERSION = 4.2;
506502
TARGETED_DEVICE_FAMILY = "1,2";
507503
};
508504
name = Debug;
@@ -519,7 +515,6 @@
519515
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
520516
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificatorTests;
521517
PRODUCT_NAME = "$(TARGET_NAME)";
522-
SWIFT_VERSION = 4.2;
523518
TARGETED_DEVICE_FAMILY = "1,2";
524519
};
525520
name = Release;
@@ -582,6 +577,7 @@
582577
SDKROOT = iphoneos;
583578
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
584579
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
580+
SWIFT_VERSION = 5.0;
585581
VERSIONING_SYSTEM = "apple-generic";
586582
VERSION_INFO_PREFIX = "";
587583
};
@@ -637,6 +633,7 @@
637633
PRODUCT_NAME = DeviceIdentificator;
638634
SDKROOT = iphoneos;
639635
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
636+
SWIFT_VERSION = 5.0;
640637
VALIDATE_PRODUCT = YES;
641638
VERSIONING_SYSTEM = "apple-generic";
642639
VERSION_INFO_PREFIX = "";
@@ -659,7 +656,6 @@
659656
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificator;
660657
SKIP_INSTALL = YES;
661658
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
662-
SWIFT_VERSION = 4.2;
663659
TARGETED_DEVICE_FAMILY = "1,2";
664660
};
665661
name = Debug;
@@ -679,7 +675,6 @@
679675
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
680676
PRODUCT_BUNDLE_IDENTIFIER = net.s3ba.DeviceIdentificator;
681677
SKIP_INSTALL = YES;
682-
SWIFT_VERSION = 4.2;
683678
TARGETED_DEVICE_FAMILY = "1,2";
684679
};
685680
name = Release;

Source/DeviceModel+Helpers.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public extension DeviceModel {
4-
public var isSimulator: Bool {
4+
var isSimulator: Bool {
55
switch self {
66
case .iPadSimulator, .iPhoneSimulator, .appleTVSimulator:
77
return true
@@ -10,15 +10,15 @@ public extension DeviceModel {
1010
}
1111
}
1212

13-
public var isAppleTV: Bool {
13+
var isAppleTV: Bool {
1414
return name.hasPrefix("Apple TV")
1515
}
1616

17-
public var isIpad: Bool {
17+
var isIpad: Bool {
1818
return name.hasPrefix("iPad")
1919
}
2020

21-
public var isIphone: Bool {
21+
var isIphone: Bool {
2222
return name.hasPrefix("iPhone")
2323
}
2424
}

Source/DeviceModel+Name.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public extension DeviceModel {
4-
public var name: String {
4+
var name: String {
55
switch self {
66
case .iPhone1G: return "iPhone 1G"
77
case .iPhone3G: return "iPhone 3G"

Source/UIDeviceExtensions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22

33
public extension UIDevice {
4-
public var deviceModel: DeviceModel {
4+
var deviceModel: DeviceModel {
55
var systemInfo = utsname()
66
uname(&systemInfo)
77

@@ -31,17 +31,17 @@ public extension UIDevice {
3131
}
3232

3333
@objc
34-
public var isIpad: Bool {
34+
var isIpad: Bool {
3535
return deviceModel.isIpad
3636
}
3737

3838
@objc
39-
public var isIphone: Bool {
39+
var isIphone: Bool {
4040
return deviceModel.isIphone
4141
}
4242

4343
@objc
44-
public var isAppleTV: Bool {
44+
var isAppleTV: Bool {
4545
return deviceModel.isAppleTV
4646
}
4747
}

0 commit comments

Comments
 (0)