Skip to content

Commit

Permalink
Merge pull request #106 from mdiep/xcode-10-2
Browse files Browse the repository at this point in the history
Move to Swift 4.2 and address Xcode 10.2 warnings
  • Loading branch information
mdiep authored Mar 29, 2019
2 parents d7f05e5 + 44bd45e commit 10d9c0f
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9.4
osx_image: xcode10.1
branches:
only:
- master
Expand All @@ -8,9 +8,19 @@ xcode_workspace: Tentacle.xcworkspace
matrix:
include:
- xcode_scheme: Tentacle-OSX
name: Xcode 10.1 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-iOS
name: Xcode 10.1 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-OSX
name: Xcode 10.2 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode10.2
- xcode_scheme: Tentacle-iOS
name: Xcode 10.2 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode10.2
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
- git:
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveCocoa/ReactiveSwift" ~> 4.0
github "ReactiveCocoa/ReactiveSwift" ~> 5.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "ReactiveCocoa/ReactiveSwift" "4.0.0"
github "ReactiveCocoa/ReactiveSwift" "5.0.0"
github "antitypical/Result" "4.1.0"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveSwift
Submodule ReactiveSwift updated 36 files
+1 −1 .swift-version
+69 −59 .travis.yml
+10 −1 CHANGELOG.md
+1 −1 Cartfile
+2 −2 Cartfile.private
+3 −3 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+1 −1 Carthage/Checkouts/Quick
+1 −1 Carthage/Checkouts/Result
+8 −8 Documentation/Example.OnlineSearch.md
+9 −9 Documentation/ReactivePrimitives.md
+1 −1 Documentation/RxComparison.md
+6 −6 Package.resolved
+3 −3 Package.swift
+19 −0 [email protected]
+1 −1 ReactiveSwift.playground/Pages/Signal.xcplaygroundpage/Contents.swift
+19 −0 ReactiveSwift.playground/Pages/SignalProducer.xcplaygroundpage/Contents.swift
+2 −2 ReactiveSwift.podspec
+4 −0 ReactiveSwift.xcodeproj/project.pbxproj
+4 −5 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-iOS.xcscheme
+4 −5 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-macOS.xcscheme
+4 −5 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-tvOS.xcscheme
+37 −0 Sources/Action.swift
+1 −1 Sources/Atomic.swift
+51 −10 Sources/Event.swift
+1 −1 Sources/Info.plist
+1 −1 Sources/ResultExtensions.swift
+10 −4 Sources/Scheduler.swift
+23 −0 Sources/Signal.swift
+25 −2 Sources/SignalProducer.swift
+45 −0 Tests/ReactiveSwiftTests/ActionSpec.swift
+1 −1 Tests/ReactiveSwiftTests/Info.plist
+1 −1 Tests/ReactiveSwiftTests/SchedulerSpec.swift
+71 −0 Tests/ReactiveSwiftTests/SignalProducerLiftingSpec.swift
+71 −0 Tests/ReactiveSwiftTests/SignalSpec.swift
+2 −1 script/build
14 changes: 8 additions & 6 deletions Sources/Tentacle/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,24 @@ extension Client.Error: Hashable {
}
}

public var hashValue: Int {
public func hash(into hasher: inout Hasher) {
switch self {
case let .networkError(error):
return (error as NSError).hashValue
(error as NSError).hash(into: &hasher)

case let .jsonDeserializationError(error):
return (error as NSError).hashValue
(error as NSError).hash(into: &hasher)

case let .jsonDecodingError(error):
return (error as NSError).hashValue
(error as NSError).hash(into: &hasher)

case let .apiError(statusCode, response, error):
return statusCode.hashValue ^ response.hashValue ^ error.hashValue
statusCode.hash(into: &hasher)
response.hash(into: &hasher)
error.hash(into: &hasher)

case .doesNotExist:
return 4
4.hash(into: &hasher)
}
}
}
4 changes: 2 additions & 2 deletions Sources/Tentacle/Commit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public struct Commit: ResourceType {
}

extension Commit: Hashable {
public var hashValue: Int {
return sha.hashValue
public func hash(into hasher: inout Hasher) {
sha.hash(into: &hasher)
}

public static func ==(lhs: Commit, rhs: Commit) -> Bool {
Expand Down
29 changes: 3 additions & 26 deletions Sources/Tentacle/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension Repository {
///
/// - file: a file when queried directly in a repository
/// - directory: a directory when queried directly in a repository (may contain multiple files)
public enum Content: ResourceType {
public enum Content: ResourceType, Hashable {
/// A file in a repository
public struct File: CustomStringConvertible, ResourceType {

Expand Down Expand Up @@ -139,9 +139,8 @@ public enum Content: ResourceType {
case content
}

// Hashable
public var hashValue: Int {
return name.hashValue
public func hash(into hasher: inout Hasher) {
name.hash(into: &hasher)
}
}

Expand All @@ -164,25 +163,3 @@ public enum Content: ResourceType {
}
}
}

extension Content: Hashable {
public static func ==(lhs: Content, rhs: Content) -> Bool {
switch (lhs, rhs) {
case let (.file(file1), .file(file2)):
return file1 == file2
case let (.directory(dir1), .directory(dir2)):
return dir1 == dir2
default:
return false
}
}

public var hashValue: Int {
switch self {
case .file(let file):
return "file".hashValue ^ file.hashValue
case .directory(let files):
return files.reduce("directory".hashValue) { $0.hashValue ^ $1.hashValue }
}
}
}
5 changes: 2 additions & 3 deletions Sources/Tentacle/File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public struct File: ResourceType, Encodable {
try container.encode(branch, forKey: .branch)
}

// Hashable
public var hashValue: Int {
return message.hashValue
public func hash(into hasher: inout Hasher) {
message.hash(into: &hasher)
}
}
4 changes: 2 additions & 2 deletions Sources/Tentacle/Identifiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public protocol Identifiable: Hashable {
}

extension Identifiable {
public var hashValue: Int {
return id.hashValue
public func hash(into hasher: inout Hasher) {
id.hash(into: &hasher)
}
}

Expand Down
4 changes: 0 additions & 4 deletions Sources/Tentacle/Label.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@ extension Label: Hashable {
public static func ==(lhs: Label, rhs: Label) -> Bool {
return lhs.name == rhs.name
}

public var hashValue: Int {
return name.hashValue
}
}

4 changes: 2 additions & 2 deletions Sources/Tentacle/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension Repository: Hashable {
&& lhs.name.caseInsensitiveCompare(rhs.name) == .orderedSame
}

public var hashValue: Int {
return description.lowercased().hashValue
public func hash(into hasher: inout Hasher) {
description.lowercased().hash(into: &hasher)
}
}
5 changes: 3 additions & 2 deletions Sources/Tentacle/RepositoryInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ extension RepositoryInfo: Hashable {
&& lhs.nameWithOwner == rhs.nameWithOwner
}

public var hashValue: Int {
return id.hashValue ^ nameWithOwner.hashValue
public func hash(into hasher: inout Hasher) {
id.hash(into: &hasher)
nameWithOwner.hash(into: &hasher)
}
}
8 changes: 0 additions & 8 deletions Sources/Tentacle/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,4 @@ public struct Request<Value>: Hashable {
self.queryItems = queryItems
self.body = body
}

// Hashable
public var hashValue: Int {
return method.hashValue
^ path.hashValue
^ queryItems.map { $0.hashValue }.reduce(0, ^)
^ (body?.hashValue ?? 0)
}
}
7 changes: 0 additions & 7 deletions Sources/Tentacle/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,4 @@ public struct Response: Hashable {
.map { Date(timeIntervalSince1970: $0) }
self.links = linksInLinkHeader(headerFields["Link"] as String? ?? "")
}

// Hashable
public var hashValue: Int {
return (rateLimitRemaining?.hashValue ?? 0)
^ (rateLimitReset?.hashValue ?? 0)
^ Array(links.values).reduce(0) { $0 ^ $1.hashValue }
}
}
4 changes: 2 additions & 2 deletions Sources/Tentacle/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension Server: Hashable {
}
}

public var hashValue: Int {
return endpoint.lowercased().hashValue
public func hash(into hasher: inout Hasher) {
endpoint.lowercased().hash(into: &hasher)
}
}
9 changes: 4 additions & 5 deletions Sources/Tentacle/Tree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ public struct Tree: CustomStringConvertible, ResourceType {
}
}

// Hashable
public var hashValue: Int {
return sha.hashValue
public func hash(into hasher: inout Hasher) {
sha.hash(into: &hasher)
}
}

Expand All @@ -185,8 +184,8 @@ extension Tree.Entry: Hashable {
return lhs.sha == rhs.sha
}

public var hashValue: Int {
return sha.hashValue
public func hash(into hasher: inout Hasher) {
sha.hash(into: &hasher)
}
}

Expand Down
5 changes: 2 additions & 3 deletions Sources/Tentacle/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ public struct UserProfile: ResourceType {
case company
}

// Hashable
public var hashValue: Int {
return user.hashValue
public func hash(into hasher: inout Hasher) {
user.hash(into: &hasher)
}
}
10 changes: 5 additions & 5 deletions Tentacle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,11 @@
};
BE88E7F11C88C6B30034A112 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0810;
LastSwiftMigration = 1020;
};
BE88E7FB1C88C6B30034A112 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0810;
LastSwiftMigration = 1020;
};
BE88E8661C88F0990034A112 = {
CreatedOnToolsVersion = 7.2.1;
Expand All @@ -705,7 +705,7 @@
};
buildConfigurationList = BE88E7EC1C88C6B30034A112 /* Build configuration list for PBXProject "Tentacle" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -1138,7 +1138,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1189,7 +1189,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down

0 comments on commit 10d9c0f

Please sign in to comment.