Skip to content

Commit

Permalink
Merge pull request #109 from olejnjak/swift5.2
Browse files Browse the repository at this point in the history
Migrate to Swift 5.2
  • Loading branch information
eliperkins authored Apr 23, 2020
2 parents 578edd0 + 2972b43 commit fb9f20c
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 204 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/
.swiftpm/xcode

# CocoaPods
#
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.2
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode10.1
osx_image: xcode11.3
branches:
only:
- master
Expand All @@ -8,26 +8,27 @@ xcode_workspace: Tentacle.xcworkspace
matrix:
include:
- xcode_scheme: Tentacle-OSX
name: Xcode 10.1 / macOS
name: Xcode 11.3 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-iOS
name: Xcode 10.1 / iOS
name: Xcode 11.3 / iOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-OSX
name: Xcode 10.2 / macOS
name: Xcode 11.4 / macOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode10.2
osx_image: xcode11.4
- xcode_scheme: Tentacle-iOS
name: Xcode 10.2 / iOS
name: Xcode 11.4 / iOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode10.2
osx_image: xcode11.4
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
- git:
submodules: false
script:
- swift build
- swift test
osx_image: xcode11.4
env:
- JOB=SWIFTPM_DARWIN
notifications:
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveCocoa/ReactiveSwift" ~> 5.0
github "ReactiveCocoa/ReactiveSwift" ~> 6.2
3 changes: 1 addition & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github "ReactiveCocoa/ReactiveSwift" "5.0.0"
github "antitypical/Result" "4.1.0"
github "ReactiveCocoa/ReactiveSwift" "6.2.1"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveSwift
Submodule ReactiveSwift updated 61 files
+0 −3 .gitmodules
+1 −1 .swift-version
+3 −18 .travis.yml
+31 −0 CHANGELOG.md
+0 −1 Cartfile
+1 −2 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+0 −1 Carthage/Checkouts/Result
+1 −2 Documentation/APIContracts.md
+19 −19 Documentation/BasicOperators.md
+2 −2 Documentation/DebuggingTechniques.md
+1 −1 Documentation/FrameworkOverview.md
+1 −1 Documentation/ReactivePrimitives.md
+1 −1 Documentation/RxComparison.md
+0 −9 Package.resolved
+6 −4 Package.swift
+0 −19 [email protected]
+8 −11 README.md
+3 −4 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Contents.swift
+0 −1 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Sources/FormView.swift
+2 −3 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Sources/UIKitExtensions.swift
+2 −4 ReactiveSwift.playground/Pages/Property.xcplaygroundpage/Contents.swift
+0 −2 ReactiveSwift.playground/Pages/Sandbox.xcplaygroundpage/Contents.swift
+19 −21 ReactiveSwift.playground/Pages/Signal.xcplaygroundpage/Contents.swift
+50 −52 ReactiveSwift.playground/Pages/SignalProducer.xcplaygroundpage/Contents.swift
+3 −4 ReactiveSwift.podspec
+4 −19 ReactiveSwift.xcodeproj/project.pbxproj
+4 −36 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-iOS.xcscheme
+4 −36 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-macOS.xcscheme
+4 −36 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-tvOS.xcscheme
+2 −4 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-watchOS.xcscheme
+0 −3 ReactiveSwift.xcworkspace/contents.xcworkspacedata
+12 −13 Sources/Action.swift
+0 −1 Sources/Deprecations+Removals.swift
+34 −30 Sources/Event.swift
+150 −18 Sources/Flatten.swift
+10 −5 Sources/FoundationExtensions.swift
+1 −1 Sources/Info.plist
+1 −2 Sources/Lifetime.swift
+40 −21 Sources/Property.swift
+39 −2 Sources/ResultExtensions.swift
+61 −31 Sources/Signal.swift
+104 −62 Sources/SignalProducer.swift
+30 −4 Sources/UnidirectionalBinding.swift
+47 −49 Sources/UninhabitedTypeGuards.swift
+2 −4 Sources/ValidatingProperty.swift
+11 −12 Tests/ReactiveSwiftTests/ActionSpec.swift
+0 −1 Tests/ReactiveSwiftTests/DeprecationSpec.swift
+121 −122 Tests/ReactiveSwiftTests/FlattenSpec.swift
+2 −3 Tests/ReactiveSwiftTests/FoundationExtensionsSpec.swift
+1 −1 Tests/ReactiveSwiftTests/Info.plist
+0 −1 Tests/ReactiveSwiftTests/LifetimeSpec.swift
+55 −16 Tests/ReactiveSwiftTests/PropertySpec.swift
+3 −4 Tests/ReactiveSwiftTests/ReactiveExtensionsSpec.swift
+27 −28 Tests/ReactiveSwiftTests/SignalLifetimeSpec.swift
+120 −121 Tests/ReactiveSwiftTests/SignalProducerLiftingSpec.swift
+708 −163 Tests/ReactiveSwiftTests/SignalProducerSpec.swift
+271 −204 Tests/ReactiveSwiftTests/SignalSpec.swift
+2 −3 Tests/ReactiveSwiftTests/TestError.swift
+12 −1 Tests/ReactiveSwiftTests/UnidirectionalBindingSpec.swift
+0 −1 Tests/ReactiveSwiftTests/ValidatingPropertySpec.swift
13 changes: 2 additions & 11 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,8 @@
"repositoryURL": "https://github.com/ReactiveCocoa/ReactiveSwift.git",
"state": {
"branch": null,
"revision": "e285cea17cca8e23928d1e85a235638184e39ac9",
"version": "5.0.0"
}
},
{
"package": "Result",
"repositoryURL": "https://github.com/antitypical/Result.git",
"state": {
"branch": null,
"revision": "2ca499ba456795616fbc471561ff1d963e6ae160",
"version": "4.1.0"
"revision": "e27ccdbf4ec36f154b60b91a0d7e0110c4e882cb",
"version": "6.2.1"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.2
import PackageDescription

let package = Package(
Expand All @@ -7,11 +7,11 @@ let package = Package(
.library(name: "Tentacle", targets: ["Tentacle"]),
],
dependencies: [
.package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", from: "5.0.0"),
.package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", from: "6.0.0"),
],
targets: [
.target(name: "Tentacle", dependencies: ["ReactiveSwift"]),
.testTarget(name: "TentacleTests", dependencies: ["Tentacle"]),
],
swiftLanguageVersions: [.v4_2]
swiftLanguageVersions: [.v5]
)
9 changes: 4 additions & 5 deletions Sources/Tentacle/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation
import ReactiveSwift
import Result

extension URL {
internal func url(with queryItems: [URLQueryItem]) -> URL {
Expand All @@ -34,7 +33,7 @@ extension URL {
extension URLSession {
/// Returns a producer that will download a file using the given request. The file will be
/// deleted after the producer terminates.
internal func downloadFile(_ request: URLRequest) -> SignalProducer<URL, AnyError> {
internal func downloadFile(_ request: URLRequest) -> SignalProducer<URL, Error> {
return SignalProducer { observer, lifetime in
let serialDisposable = SerialDisposable()
let handle = lifetime += serialDisposable
Expand All @@ -47,7 +46,7 @@ extension URLSession {
observer.send(value: url)
observer.sendCompleted()
} else if let error = error {
observer.send(error: AnyError(error))
observer.send(error: error)
} else {
fatalError("Request neither succeeded nor failed: \(String(describing: request.url))")
}
Expand Down Expand Up @@ -151,7 +150,7 @@ public final class Client {
public func download(asset: Release.Asset) -> SignalProducer<URL, Error> {
return urlSession
.downloadFile(urlRequest(for: asset.apiURL, contentType: Client.DownloadContentType))
.mapError { Error.networkError($0.error) }
.mapError { Error.networkError($0) }
}

/// Create a `URLRequest` for the given URL with the given content type.
Expand Down Expand Up @@ -185,7 +184,7 @@ public final class Client {
return urlSession
.reactive
.data(with: urlRequest(for: request, page: page, perPage: perPage))
.mapError { Error.networkError($0.error) }
.mapError { Error.networkError($0) }
.flatMap(.concat) { data, response -> SignalProducer<(Response, Data), Error> in
let response = response as! HTTPURLResponse
let headers = response.allHeaderFields as! [String:String]
Expand Down
9 changes: 4 additions & 5 deletions Sources/Tentacle/JSONExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@
//

import Foundation
import Result

internal func decode<T: Decodable>(_ payload: Data) -> Result<T, DecodingError> {
return Result(catching: { () -> T in
Result {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(DateFormatter.iso8601)
return try decoder.decode(T.self, from: payload)
})
}.mapError { $0 as! DecodingError }
}

internal func decodeList<T: Decodable>(_ payload: Data) -> Result<[T], DecodingError> {
return Result(catching: { () -> [T] in
Result { () -> [T] in
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(DateFormatter.iso8601)
return try decoder.decode([T].self, from: payload)
})
}.mapError { $0 as! DecodingError }
}

extension DecodingError.Context: Equatable {
Expand Down
20 changes: 4 additions & 16 deletions Tentacle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@
928DF21F1E0E693000E6DE35 /* create-file-sample-response.data in Resources */ = {isa = PBXBuildFile; fileRef = 928DF21D1E0E692600E6DE35 /* create-file-sample-response.data */; };
928DF2201E0E693100E6DE35 /* create-file-sample-response.data in Resources */ = {isa = PBXBuildFile; fileRef = 928DF21D1E0E692600E6DE35 /* create-file-sample-response.data */; };
928DF22A1E0E6A1200E6DE35 /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 928DF2241E0E6A1200E6DE35 /* ReactiveSwift.framework */; };
928DF22B1E0E6A1200E6DE35 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 928DF2251E0E6A1200E6DE35 /* Result.framework */; };
928DF22D1E0E6A8000E6DE35 /* FileResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928DF21B1E0E68D300E6DE35 /* FileResponseTests.swift */; };
928DF22E1E0E6A8100E6DE35 /* FileResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928DF21B1E0E68D300E6DE35 /* FileResponseTests.swift */; };
928DF2381E0E95B600E6DE35 /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 928DF2321E0E95B600E6DE35 /* ReactiveSwift.framework */; };
928DF2391E0E95B600E6DE35 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 928DF2331E0E95B600E6DE35 /* Result.framework */; };
928DF23E1E1117D600E6DE35 /* Sha.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928DF23D1E1117D600E6DE35 /* Sha.swift */; };
928DF23F1E11187C00E6DE35 /* Sha.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928DF23D1E1117D600E6DE35 /* Sha.swift */; };
92F0C2BA1E391088004A9889 /* FileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F0C2B91E391088004A9889 /* FileTests.swift */; };
Expand Down Expand Up @@ -302,9 +300,7 @@
928DF21B1E0E68D300E6DE35 /* FileResponseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileResponseTests.swift; sourceTree = "<group>"; };
928DF21D1E0E692600E6DE35 /* create-file-sample-response.data */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "create-file-sample-response.data"; sourceTree = "<group>"; };
928DF2241E0E6A1200E6DE35 /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = "../../../Library/Developer/Xcode/DerivedData/Tentacle-bqioixzqvwloakfnodqjigugjqbv/Build/Products/Debug-iphonesimulator/ReactiveSwift.framework"; sourceTree = "<group>"; };
928DF2251E0E6A1200E6DE35 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../../Library/Developer/Xcode/DerivedData/Tentacle-bqioixzqvwloakfnodqjigugjqbv/Build/Products/Debug-iphonesimulator/Result.framework"; sourceTree = "<group>"; };
928DF2321E0E95B600E6DE35 /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = Carthage/Checkouts/ReactiveSwift/build/Debug/ReactiveSwift.framework; sourceTree = SOURCE_ROOT; };
928DF2331E0E95B600E6DE35 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../../Library/Developer/Xcode/DerivedData/Tentacle-bqioixzqvwloakfnodqjigugjqbv/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; };
928DF23D1E1117D600E6DE35 /* Sha.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sha.swift; sourceTree = "<group>"; };
92F0C2B91E391088004A9889 /* FileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileTests.swift; sourceTree = "<group>"; };
BE0F409F1C89098E00E3B11A /* Fixture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Fixture.swift; path = Tests/TentacleTests/Fixture.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -351,7 +347,6 @@
buildActionMask = 2147483647;
files = (
928DF22A1E0E6A1200E6DE35 /* ReactiveSwift.framework in Frameworks */,
928DF22B1E0E6A1200E6DE35 /* Result.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -368,7 +363,6 @@
buildActionMask = 2147483647;
files = (
928DF2381E0E95B600E6DE35 /* ReactiveSwift.framework in Frameworks */,
928DF2391E0E95B600E6DE35 /* Result.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -513,11 +507,14 @@
BE88E8001C88C6B30034A112 /* Tests */ = {
isa = PBXGroup;
children = (
7A8A9D641E5547F50009DA9E /* BranchTests.swift */,
BE2B6A6B1C8B854F0080BFEB /* ClientTests.swift */,
7A1F20EF1D3E86D900F275F8 /* ColorTests.swift */,
7A27887B1D49223B007AC936 /* CommentsTests.swift */,
7A072D8D1DED11C900CFE58F /* ContentTests.swift */,
7A22EDBB1E47CB8900524539 /* EndpointTests.swift */,
928DF21B1E0E68D300E6DE35 /* FileResponseTests.swift */,
92F0C2B91E391088004A9889 /* FileTests.swift */,
BE0F409F1C89098E00E3B11A /* Fixture.swift */,
BE0F40961C8908CB00E3B11A /* Fixtures */,
BEB0765E1C8A019A00ABD373 /* GitHubErrorTests.swift */,
Expand All @@ -529,11 +526,8 @@
BEA86F9C1C9F7E1E0049360B /* RepositoryTests.swift */,
BE1E036A1C9AD87F001296C2 /* ResponseTests.swift */,
BEA86F991C9F7C230049360B /* ServerTests.swift */,
BECB8AA11CBDDF0F005D70A6 /* UserTests.swift */,
928DF21B1E0E68D300E6DE35 /* FileResponseTests.swift */,
92F0C2B91E391088004A9889 /* FileTests.swift */,
7A8A9D641E5547F50009DA9E /* BranchTests.swift */,
BF01A2601EAA63100028ECFC /* TreeTests.swift */,
BECB8AA11CBDDF0F005D70A6 /* UserTests.swift */,
);
name = Tests;
path = Tests/TentacleTests;
Expand All @@ -543,9 +537,7 @@
isa = PBXGroup;
children = (
928DF2321E0E95B600E6DE35 /* ReactiveSwift.framework */,
928DF2331E0E95B600E6DE35 /* Result.framework */,
928DF2241E0E6A1200E6DE35 /* ReactiveSwift.framework */,
928DF2251E0E6A1200E6DE35 /* Result.framework */,
);
name = Frameworks;
path = Tentacle;
Expand Down Expand Up @@ -1027,7 +1019,6 @@
PRODUCT_NAME = Tentacle;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1049,7 +1040,6 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -1065,7 +1055,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.diephouse.matt.TentacleiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
};
name = Debug;
};
Expand All @@ -1080,7 +1069,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Loading

0 comments on commit fb9f20c

Please sign in to comment.