Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 5: No, seriously #592

Merged
merged 7 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martijnwalraven I'll want to make this 0.11.0 if we get #551 merged in soon

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)))]
}
}