Skip to content

Commit

Permalink
Merge pull request #592 from apollographql/update/swift-5-no-really
Browse files Browse the repository at this point in the history
Swift 5: No, seriously
  • Loading branch information
designatednerd authored Jul 2, 2019
2 parents 606e2c0 + c0a1163 commit d2e19e9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Apollo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion Configuration/Shared/Project-Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 0.10.1
CURRENT_PROJECT_VERSION = 0.10.2
6 changes: 0 additions & 6 deletions Sources/Apollo/Collections.swift
Original file line number Diff line number Diff line change
@@ -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
}
}

Expand Down
3 changes: 3 additions & 0 deletions Sources/ApolloWebSocket/SplitNetworkTransport.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#if !COCOAPODS
import Apollo
#endif


public class SplitNetworkTransport: NetworkTransport {
private let httpNetworkTransport: NetworkTransport
Expand Down
2 changes: 2 additions & 0 deletions Sources/ApolloWebSocket/WebSocketTransport.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#if !COCOAPODS
import Apollo
#endif
import Starscream

// To allow for alternative implementations supporting the same WebSocketClient protocol
Expand Down
15 changes: 1 addition & 14 deletions Tests/ApolloWebsocketTests/StarWarsSubscriptionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand All @@ -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)))]
}
}

0 comments on commit d2e19e9

Please sign in to comment.