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

Update ReactiveSwift to 2.0 #86

Merged
merged 2 commits into from
Jul 25, 2017
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 .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.1
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.2
osx_image: xcode8.3
branches:
only:
- master
Expand All @@ -13,12 +13,6 @@ matrix:
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-OSX
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8.3
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8.3
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
- before_script: true
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "ReactiveCocoa/ReactiveSwift" ~> 1.1.5
github "ReactiveCocoa/ReactiveSwift" ~> 2.0
github "thoughtbot/Argo" ~> 4.1.2
github "thoughtbot/Curry" ~> 3.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "ReactiveCocoa/ReactiveSwift" "1.1.5"
github "ReactiveCocoa/ReactiveSwift" "2.0.0"
github "antitypical/Result" "3.2.3"
github "thoughtbot/Argo" "v4.1.2"
github "thoughtbot/Curry" "v3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveSwift
Submodule ReactiveSwift updated 69 files
+0 −10 .Package.test.swift
+3 −0 .github/PULL_REQUEST_TEMPLATE.md
+4 −0 .gitignore
+9 −14 .jazzy.yaml
+87 −27 .travis.yml
+243 −0 CHANGELOG.md
+1 −1 Cartfile.private
+1 −1 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+14 −14 Documentation/APIContracts.md
+6 −6 Documentation/BasicOperators.md
+173 −0 Documentation/Example.OnlineSearch.md
+1 −1 Documentation/FrameworkOverview.md
+115 −0 Documentation/ReactivePrimitives.md
+89 −0 Documentation/RxComparison.md
+ Logo/Icons/docset-icon.png
+ Logo/Icons/[email protected]
+24 −0 Package.pins
+34 −0 Package.resolved
+18 −3 Package.swift
+49 −381 README.md
+44 −20 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Contents.swift
+2 −2 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Sources/UIKitExtensions.swift
+5 −5 ReactiveSwift.playground/Pages/Property.xcplaygroundpage/Contents.swift
+12 −12 ReactiveSwift.playground/Pages/Signal.xcplaygroundpage/Contents.swift
+7 −7 ReactiveSwift.playground/Pages/SignalProducer.xcplaygroundpage/Contents.swift
+1 −1 ReactiveSwift.playground/contents.xcplayground
+1 −1 ReactiveSwift.podspec
+11 −51 ReactiveSwift.xcodeproj/project.pbxproj
+226 −212 Sources/Action.swift
+110 −121 Sources/Atomic.swift
+52 −58 Sources/Bag.swift
+124 −567 Sources/Deprecations+Removals.swift
+140 −187 Sources/Disposable.swift
+119 −115 Sources/Event.swift
+13 −13 Sources/EventLogger.swift
+381 −568 Sources/Flatten.swift
+5 −7 Sources/FoundationExtensions.swift
+1 −1 Sources/Info.plist
+132 −0 Sources/InhabitableTypeGuards.swift
+50 −33 Sources/Lifetime.swift
+102 −85 Sources/Observer.swift
+2 −2 Sources/Optional.swift
+239 −191 Sources/Property.swift
+33 −26 Sources/Scheduler.swift
+1,041 −819 Sources/Signal.swift
+857 −742 Sources/SignalProducer.swift
+0 −42 Sources/TupleExtensions.swift
+115 −118 Sources/UnidirectionalBinding.swift
+66 −66 Sources/ValidatingProperty.swift
+113 −26 Tests/ReactiveSwiftTests/ActionSpec.swift
+1 −28 Tests/ReactiveSwiftTests/DeprecationSpec.swift
+11 −11 Tests/ReactiveSwiftTests/DisposableSpec.swift
+63 −11 Tests/ReactiveSwiftTests/FlattenSpec.swift
+7 −7 Tests/ReactiveSwiftTests/FoundationExtensionsSpec.swift
+1 −1 Tests/ReactiveSwiftTests/Info.plist
+54 −35 Tests/ReactiveSwiftTests/PropertySpec.swift
+118 −46 Tests/ReactiveSwiftTests/SignalLifetimeSpec.swift
+104 −21 Tests/ReactiveSwiftTests/SignalProducerLiftingSpec.swift
+1 −1 Tests/ReactiveSwiftTests/SignalProducerNimbleMatchers.swift
+333 −96 Tests/ReactiveSwiftTests/SignalProducerSpec.swift
+319 −41 Tests/ReactiveSwiftTests/SignalSpec.swift
+2 −2 Tests/ReactiveSwiftTests/TestError.swift
+88 −38 Tests/ReactiveSwiftTests/UnidirectionalBindingSpec.swift
+1 −1 Tests/ReactiveSwiftTests/ValidatingPropertySpec.swift
+1 −1 script/build
+4 −0 script/feed.xml.template
+33 −8 script/gen-docs
+24 −0 script/update-version
36 changes: 36 additions & 0 deletions Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"autoPin": true,
"pins": [
{
"package": "Argo",
"reason": null,
"repositoryURL": "https://github.com/thoughtbot/Argo.git",
"version": "4.1.2"
},
{
"package": "Curry",
"reason": null,
"repositoryURL": "https://github.com/thoughtbot/Curry.git",
"version": "3.0.0"
},
{
"package": "ReactiveSwift",
"reason": null,
"repositoryURL": "https://github.com/ReactiveCocoa/ReactiveSwift.git",
"version": "2.0.0"
},
{
"package": "Result",
"reason": null,
"repositoryURL": "https://github.com/antitypical/Result.git",
"version": "3.2.3"
},
{
"package": "Runes",
"reason": null,
"repositoryURL": "https://github.com/thoughtbot/Runes.git",
"version": "4.1.0"
}
],
"version": 1
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ let package = Package(
dependencies: [
.Package(url: "https://github.com/thoughtbot/Argo.git", versions: Version(4, 1, 2)..<Version(4, .max, .max)),
.Package(url: "https://github.com/thoughtbot/Curry.git", majorVersion: 3),
.Package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", versions: Version(1, 1, 5)..<Version(1, .max, .max)),
.Package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", majorVersion: 2),
]
)
20 changes: 12 additions & 8 deletions Sources/Tentacle/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ 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> {
return SignalProducer { observer, disposable in
return SignalProducer { observer, lifetime in
let serialDisposable = SerialDisposable()
let handle = disposable.add(serialDisposable)
let handle = lifetime += serialDisposable

let task = self.downloadTask(with: request) { (url, response, error) in
// Avoid invoking cancel(), or the download may be deleted.
handle.remove()
handle?.dispose()

if let url = url {
observer.send(value: url)
Expand All @@ -60,7 +60,7 @@ extension URLSession {
}
}

serialDisposable.inner = ActionDisposable {
serialDisposable.inner = AnyDisposable {
task.cancel()
}

Expand Down Expand Up @@ -196,10 +196,14 @@ public final class Client {
.flatMap(.concat) { data, response -> SignalProducer<(Response, Any), Error> in
let response = response as! HTTPURLResponse
let headers = response.allHeaderFields as! [String:String]
return SignalProducer
.attempt {
return JSONSerialization.deserializeJSON(data).mapError { Error.jsonDeserializationError($0.error) }
}

// The explicitness is required to pick up
// `init(_ action: @escaping () -> Result<Value, Error>)`
// over `init(_ action: @escaping () -> Value)`.
let producer: SignalProducer<Any, Error> = SignalProducer { () -> Result<Any, Error> in
return JSONSerialization.deserializeJSON(data).mapError { Error.jsonDeserializationError($0.error) }
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

let producer: SignalProducer<Any, Error> = SignalProducer {
    return JSONSerialization.deserializeJSON(data).mapError { Error.jsonDeserializationError($0.error) }
}

is not sufficient because Result<Any, Error> itself is treated as Any, so init(_ action: @escaping () -> Value) is still used.

Copy link
Owner

Choose a reason for hiding this comment

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

Maybe we should remove the () -> Value initializer—or rename it to be a static func. 😕

return producer
.attemptMap { JSON in
if response.statusCode == 404 {
return .failure(.doesNotExist)
Expand Down