Skip to content

Commit

Permalink
Swift 5 update (kasketis#158)
Browse files Browse the repository at this point in the history
Updating to swift 5
  • Loading branch information
jakubpetrik authored and felipeflorencio committed Apr 13, 2019
1 parent 8b6d290 commit f9735d8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
5.0
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# * https://github.com/supermarin/xcpretty#usage

os: osx
osx_image: xcode10
osx_image: xcode10.2
language: swift
script:
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_ios -sdk iphonesimulator12.0 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=4.0 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_ios -sdk iphonesimulator12.0 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=4.2 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_osx -sdk macosx10.14 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=4.0 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_ios -sdk iphonesimulator12.2 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=4.2 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_ios -sdk iphonesimulator12.2 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=5.0 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_osx -sdk macosx10.14 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=4.2 | xcpretty
- set -o pipefail && xcodebuild -project netfox.xcodeproj -scheme netfox_osx -sdk macosx10.14 ONLY_ACTIVE_ARCH=NO SWIFT_VERSION=5.0 | xcpretty
- pod lib lint --quick
12 changes: 7 additions & 5 deletions netfox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = kasketis;
TargetAttributes = {
8229AD611F8FB34300A9D613 = {
Expand All @@ -364,7 +364,7 @@
};
B3BC020E1C09CDA000C17F3A = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
E20FD2E81C6912D400DCFF61 = {
CreatedOnToolsVersion = 7.2.1;
Expand All @@ -374,7 +374,7 @@
};
buildConfigurationList = B3BC02091C09CDA000C17F3A /* Build configuration list for PBXProject "netfox" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -592,6 +592,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -650,6 +651,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -715,7 +717,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -735,7 +737,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.kasketis.netfox-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
9 changes: 5 additions & 4 deletions netfox/Core/NFXHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ extension URLRequest
case .returnCacheDataElseLoad: return "ReturnCacheDataElseLoad"
case .returnCacheDataDontLoad: return "ReturnCacheDataDontLoad"
case .reloadRevalidatingCacheData: return "ReloadRevalidatingCacheData"
@unknown default: return "Unknown \(cachePolicy)"
}

}
Expand Down Expand Up @@ -418,7 +419,7 @@ extension String
method_exchangeImplementations(origMethod, newMethod)
}

private var protocolClasses_Swizzled: [AnyClass]? {
@objc private var protocolClasses_Swizzled: [AnyClass]? {
get {
// Unused, but required for compiler
return self.protocolClasses_Swizzled
Expand Down Expand Up @@ -453,7 +454,7 @@ extension String
method_exchangeImplementations(origMethod, newMethod)
}

private class var default_swizzled: URLSessionConfiguration {
@objc private class var default_swizzled: URLSessionConfiguration {
get {
let config = URLSessionConfiguration.default_swizzled

Expand All @@ -468,6 +469,6 @@ extension String
public extension NSNotification.Name {
static let NFXDeactivateSearch = Notification.Name("NFXDeactivateSearch")
static let NFXReloadData = Notification.Name("NFXReloadData")
public static let NFXAddedModel = Notification.Name("NFXAddedModel")
public static let NFXClearedModels = Notification.Name("NFXClearedModels")
static let NFXAddedModel = Notification.Name("NFXAddedModel")
static let NFXClearedModels = Notification.Name("NFXClearedModels")
}
4 changes: 2 additions & 2 deletions netfox/iOS/NFXDetailsController_iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
}

@objc func handleSwipe(_ gesture: UISwipeGestureRecognizer) {
guard let currentButtonIdx = headerButtons.index(where: { $0.isSelected }) else { return }
guard let currentButtonIdx = headerButtons.firstIndex(where: { $0.isSelected }) else { return }
let numButtons = headerButtons.count

switch gesture.direction {
Expand All @@ -236,7 +236,7 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle

func buttonPressed(_ sender: UIButton)
{
guard let selectedButtonIdx = self.headerButtons.index(of: sender) else { return }
guard let selectedButtonIdx = self.headerButtons.firstIndex(of: sender) else { return }
let infoViews = [self.infoView, self.requestView, self.responseView]

UIView.animate(withDuration: 0.4,
Expand Down

0 comments on commit f9735d8

Please sign in to comment.