From 7fefacea83f29f852e533b236bbf4fe49214c504 Mon Sep 17 00:00:00 2001 From: Dusan Terzic Date: Wed, 27 Mar 2019 15:05:07 +0100 Subject: [PATCH 1/5] - Migrated to Xcode 10.2 and Swift 5. - Fixed warnings reported by Swift 5. --- Embassy.xcodeproj/project.pbxproj | 9 +++++++-- Sources/DefaultLogger.swift | 10 +++++----- Sources/HTTPHeaderParser.swift | 2 +- Sources/TCPSocket.swift | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Embassy.xcodeproj/project.pbxproj b/Embassy.xcodeproj/project.pbxproj index 14f6ac6..3f031f9 100644 --- a/Embassy.xcodeproj/project.pbxproj +++ b/Embassy.xcodeproj/project.pbxproj @@ -539,11 +539,11 @@ }; D85613E81CEE6B160060CCB7 = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; D85613F21CEE6B160060CCB7 = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; }; }; @@ -552,6 +552,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = D85613DF1CEE6B160060CCB7; @@ -1072,6 +1073,7 @@ PRODUCT_NAME = Embassy; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1090,6 +1092,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.envoy.Embassy; PRODUCT_NAME = Embassy; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1100,6 +1103,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.envoy.Embassy-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1110,6 +1114,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.envoy.Embassy-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Sources/DefaultLogger.swift b/Sources/DefaultLogger.swift index b41cf54..26d8709 100644 --- a/Sources/DefaultLogger.swift +++ b/Sources/DefaultLogger.swift @@ -35,7 +35,7 @@ public final class DefaultLogger: Logger { file: String = #file, line: Int = #line ) { - log(level: .debug, message: message, caller: caller, file: file, line: line) + log(level: .debug, message: message(), caller: caller, file: file, line: line) } public func info( @@ -44,7 +44,7 @@ public final class DefaultLogger: Logger { file: String = #file, line: Int = #line ) { - log(level: .info, message: message, caller: caller, file: file, line: line) + log(level: .info, message: message(), caller: caller, file: file, line: line) } public func warning( @@ -53,7 +53,7 @@ public final class DefaultLogger: Logger { file: String = #file, line: Int = #line ) { - log(level: .warning, message: message, caller: caller, file: file, line: line) + log(level: .warning, message: message(), caller: caller, file: file, line: line) } public func error( @@ -62,7 +62,7 @@ public final class DefaultLogger: Logger { file: String = #file, line: Int = #line ) { - log(level: .error, message: message, caller: caller, file: file, line: line) + log(level: .error, message: message(), caller: caller, file: file, line: line) } public func critical( @@ -71,7 +71,7 @@ public final class DefaultLogger: Logger { file: String = #file, line: Int = #line ) { - log(level: .critical, message: message, caller: caller, file: file, line: line) + log(level: .critical, message: message(), caller: caller, file: file, line: line) } func log( diff --git a/Sources/HTTPHeaderParser.swift b/Sources/HTTPHeaderParser.swift index b042a1d..573db9c 100644 --- a/Sources/HTTPHeaderParser.swift +++ b/Sources/HTTPHeaderParser.swift @@ -54,7 +54,7 @@ public struct HTTPHeaderParser { buffer[1.. in current buffer - guard let index = (charPairs).index(where: { $0 == HTTPHeaderParser.NEWLINE }) else { + guard let index = (charPairs).firstIndex(where: { $0 == HTTPHeaderParser.NEWLINE }) else { // no found, just return the current elements return elements } diff --git a/Sources/TCPSocket.swift b/Sources/TCPSocket.swift index 8617af8..17314af 100644 --- a/Sources/TCPSocket.swift +++ b/Sources/TCPSocket.swift @@ -291,7 +291,7 @@ public final class TCPSocket { }) else { throw OSError.lastIOError() } - if let index = address.index(of: 0) { + if let index = address.firstIndex(of: 0) { address = address.subdata(in: 0 ..< index) } return String(data: address, encoding: .utf8)! From f4661837afe207554126e31dc7504b4a697257f4 Mon Sep 17 00:00:00 2001 From: Dusan Terzic Date: Wed, 27 Mar 2019 15:14:08 +0100 Subject: [PATCH 2/5] - Set xcode version to 10.2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8559127..3b4d552 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10.1 +osx_image: xcode10.2 env: global: - LC_CTYPE=en_US.UTF-8 From 74ed22a004f1a69f73911fa9920d964e329247df Mon Sep 17 00:00:00 2001 From: Dusan Terzic Date: Wed, 27 Mar 2019 15:23:01 +0100 Subject: [PATCH 3/5] - Set the ios simulator version to 12.2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b4d552..7c3a4fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ env: - LANG=en_US.UTF-8 - WORKSPACE=Embassy.xcworkspace - IOS_FRAMEWORK_SCHEME="Embassy-iOS" - - IOS_SDK=iphonesimulator12.1 + - IOS_SDK=iphonesimulator12.2 - MACOS_FRAMEWORK_SCHEME="Embassy-macOS" - MACOS_SDK=macosx10.14 matrix: From e0a2c0e0f3ffcf0d4494369a7a68dc6cb5a0b80d Mon Sep 17 00:00:00 2001 From: Dusan Terzic Date: Wed, 27 Mar 2019 15:32:56 +0100 Subject: [PATCH 4/5] - Updated destination --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7c3a4fd..3f72ab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - MACOS_FRAMEWORK_SCHEME="Embassy-macOS" - MACOS_SDK=macosx10.14 matrix: - - DESTINATION="OS=12.1,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" + - DESTINATION="OS=12.2,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" - DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" script: From c3ca214233a62dfd5607b9cbd6ea3ed18d25bdcb Mon Sep 17 00:00:00 2001 From: Dusan Terzic Date: Thu, 28 Mar 2019 09:40:47 +0100 Subject: [PATCH 5/5] - Removed deprecated language. --- Embassy.xcodeproj/project.pbxproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Embassy.xcodeproj/project.pbxproj b/Embassy.xcodeproj/project.pbxproj index 3f031f9..4c04242 100644 --- a/Embassy.xcodeproj/project.pbxproj +++ b/Embassy.xcodeproj/project.pbxproj @@ -552,7 +552,6 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( - English, en, ); mainGroup = D85613DF1CEE6B160060CCB7;