From 6fffee04e0f1f8f9b022e5cae053e2d64bb9a9f9 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Tue, 25 Jun 2019 16:56:30 +0200 Subject: [PATCH 1/7] bump swift version in the podspec to 5.0 --- Apollo.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo.podspec b/Apollo.podspec index 492cf81e1c..df34308d38 100644 --- a/Apollo.podspec +++ b/Apollo.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.requires_arc = true - s.swift_version = '4.2' + s.swift_version = '5.0' s.default_subspecs = 'Core' From 377b2e8957380cb923b6aaa8d78e64c76f8d289c Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Tue, 25 Jun 2019 16:57:50 +0200 Subject: [PATCH 2/7] bump project version so changes to allow better Swift 5 compatibility get picked up --- Configuration/Shared/Project-Version.xcconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Shared/Project-Version.xcconfig b/Configuration/Shared/Project-Version.xcconfig index 0f58ba6b52..4fbb33bd20 100644 --- a/Configuration/Shared/Project-Version.xcconfig +++ b/Configuration/Shared/Project-Version.xcconfig @@ -1 +1 @@ -CURRENT_PROJECT_VERSION = 0.10.1 +CURRENT_PROJECT_VERSION = 0.10.2 From bb5c3f2cb95a73b1b14fa0530d5bee4e018e9b20 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Tue, 25 Jun 2019 17:21:48 +0200 Subject: [PATCH 3/7] remove unnecessary imports cocoapods is whining about --- Sources/ApolloWebSocket/SplitNetworkTransport.swift | 2 -- Sources/ApolloWebSocket/WebSocketTransport.swift | 1 - 2 files changed, 3 deletions(-) diff --git a/Sources/ApolloWebSocket/SplitNetworkTransport.swift b/Sources/ApolloWebSocket/SplitNetworkTransport.swift index e235c2ed94..7c949f1c50 100644 --- a/Sources/ApolloWebSocket/SplitNetworkTransport.swift +++ b/Sources/ApolloWebSocket/SplitNetworkTransport.swift @@ -1,5 +1,3 @@ -import Apollo - public class SplitNetworkTransport: NetworkTransport { private let httpNetworkTransport: NetworkTransport private let webSocketNetworkTransport: NetworkTransport diff --git a/Sources/ApolloWebSocket/WebSocketTransport.swift b/Sources/ApolloWebSocket/WebSocketTransport.swift index c199326d86..915413d21c 100644 --- a/Sources/ApolloWebSocket/WebSocketTransport.swift +++ b/Sources/ApolloWebSocket/WebSocketTransport.swift @@ -1,4 +1,3 @@ -import Apollo import Starscream // To allow for alternative implementations supporting the same WebSocketClient protocol From c7667c46bed723e7a8ca1df13193344de95d44e6 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Tue, 25 Jun 2019 17:44:23 +0200 Subject: [PATCH 4/7] replace custom random element picker with stdlib one --- .../StarWarsSubscriptionTests.swift | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Tests/ApolloWebsocketTests/StarWarsSubscriptionTests.swift b/Tests/ApolloWebsocketTests/StarWarsSubscriptionTests.swift index c89518c6b1..b5990648fe 100644 --- a/Tests/ApolloWebsocketTests/StarWarsSubscriptionTests.swift +++ b/Tests/ApolloWebsocketTests/StarWarsSubscriptionTests.swift @@ -149,7 +149,7 @@ class StarWarsSubscriptionTests: XCTestCase { for i in 1...count { let review = ReviewInput(stars: i, commentary: "The greatest movie ever!") - let episode = episodes.sample() + let episode = episodes.randomElement() _ = client.perform(mutation: CreateReviewForEpisodeMutation(episode: episode!, review: review)) } @@ -160,16 +160,3 @@ class StarWarsSubscriptionTests: XCTestCase { subNewHope.cancel() } } - -// MARK: - Helpers - -extension Collection where Index == Int { - /** - Picks a random element of the collection. - - - returns: A random element of the collection. - */ - func sample() -> Iterator.Element? { - return isEmpty ? nil : self[Int(arc4random_uniform(UInt32(endIndex)))] - } -} From 1fd35e86c9d892c369a3be4322e8bc7dff5065e6 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Wed, 26 Jun 2019 15:12:49 +0200 Subject: [PATCH 5/7] remove conditional wrapper for v old version of swift --- Sources/Apollo/Collections.swift | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Sources/Apollo/Collections.swift b/Sources/Apollo/Collections.swift index 43b6459b0d..6ad5532b1a 100644 --- a/Sources/Apollo/Collections.swift +++ b/Sources/Apollo/Collections.swift @@ -1,12 +1,6 @@ public extension Dictionary { static func += (lhs: inout Dictionary, rhs: Dictionary) { - #if swift(>=3.2) lhs.merge(rhs) { (_, new) in new } - #else - for (key, value) in rhs { - lhs[key] = value - } - #endif } } From 9c00ef87eb18b1e670965d887b14c2592230f5a1 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Thu, 27 Jun 2019 16:41:40 +0200 Subject: [PATCH 6/7] re-add imports because apparently we do need them despite cocoapods' warning --- Sources/ApolloWebSocket/SplitNetworkTransport.swift | 4 ++++ Sources/ApolloWebSocket/WebSocketTransport.swift | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Sources/ApolloWebSocket/SplitNetworkTransport.swift b/Sources/ApolloWebSocket/SplitNetworkTransport.swift index 7c949f1c50..3a55be6858 100644 --- a/Sources/ApolloWebSocket/SplitNetworkTransport.swift +++ b/Sources/ApolloWebSocket/SplitNetworkTransport.swift @@ -1,3 +1,7 @@ +// NOTE: Cocoapods spec linting will complain about this import, +// but you should not remove it or things won't build. +import Apollo + public class SplitNetworkTransport: NetworkTransport { private let httpNetworkTransport: NetworkTransport private let webSocketNetworkTransport: NetworkTransport diff --git a/Sources/ApolloWebSocket/WebSocketTransport.swift b/Sources/ApolloWebSocket/WebSocketTransport.swift index 915413d21c..827be509bd 100644 --- a/Sources/ApolloWebSocket/WebSocketTransport.swift +++ b/Sources/ApolloWebSocket/WebSocketTransport.swift @@ -1,3 +1,6 @@ +// NOTE: Cocoapods spec linting will complain about this import, +// but you should not remove it or things won't build. +import Apollo import Starscream // To allow for alternative implementations supporting the same WebSocketClient protocol From c0a1163160cd7e53eb64a99a37b42fb170613079 Mon Sep 17 00:00:00 2001 From: Ellen Shapiro Date: Fri, 28 Jun 2019 18:18:40 +0200 Subject: [PATCH 7/7] Only import apollo if not using cocoapods --- Sources/ApolloWebSocket/SplitNetworkTransport.swift | 5 +++-- Sources/ApolloWebSocket/WebSocketTransport.swift | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/ApolloWebSocket/SplitNetworkTransport.swift b/Sources/ApolloWebSocket/SplitNetworkTransport.swift index 3a55be6858..1df2768efb 100644 --- a/Sources/ApolloWebSocket/SplitNetworkTransport.swift +++ b/Sources/ApolloWebSocket/SplitNetworkTransport.swift @@ -1,6 +1,7 @@ -// NOTE: Cocoapods spec linting will complain about this import, -// but you should not remove it or things won't build. +#if !COCOAPODS import Apollo +#endif + public class SplitNetworkTransport: NetworkTransport { private let httpNetworkTransport: NetworkTransport diff --git a/Sources/ApolloWebSocket/WebSocketTransport.swift b/Sources/ApolloWebSocket/WebSocketTransport.swift index 827be509bd..53e475776a 100644 --- a/Sources/ApolloWebSocket/WebSocketTransport.swift +++ b/Sources/ApolloWebSocket/WebSocketTransport.swift @@ -1,6 +1,6 @@ -// NOTE: Cocoapods spec linting will complain about this import, -// but you should not remove it or things won't build. +#if !COCOAPODS import Apollo +#endif import Starscream // To allow for alternative implementations supporting the same WebSocketClient protocol