Skip to content

Commit fe46f82

Browse files
authored
Merge pull request #86 from mdiep/ras-2.0
Update ReactiveSwift to 2.0
2 parents 578adae + d09b749 commit fe46f82

File tree

8 files changed

+54
-20
lines changed

8 files changed

+54
-20
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.2
1+
3.1

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode8.2
2+
osx_image: xcode8.3
33
branches:
44
only:
55
- master
@@ -13,12 +13,6 @@ matrix:
1313
env: XCODE_ACTION="build-for-testing test-without-building"
1414
- xcode_scheme: Tentacle-iOS
1515
env: XCODE_ACTION="build-for-testing test-without-building"
16-
- xcode_scheme: Tentacle-OSX
17-
env: XCODE_ACTION="build-for-testing test-without-building"
18-
osx_image: xcode8.3
19-
- xcode_scheme: Tentacle-iOS
20-
env: XCODE_ACTION="build-for-testing test-without-building"
21-
osx_image: xcode8.3
2216
- xcode_scheme: update-test-fixtures
2317
env: XCODE_ACTION=build
2418
- before_script: true

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
github "ReactiveCocoa/ReactiveSwift" ~> 1.1.5
1+
github "ReactiveCocoa/ReactiveSwift" ~> 2.0
22
github "thoughtbot/Argo" ~> 4.1.2
33
github "thoughtbot/Curry" ~> 3.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github "ReactiveCocoa/ReactiveSwift" "1.1.5"
1+
github "ReactiveCocoa/ReactiveSwift" "2.0.0"
22
github "antitypical/Result" "3.2.3"
33
github "thoughtbot/Argo" "v4.1.2"
44
github "thoughtbot/Curry" "v3.0.0"

Carthage/Checkouts/ReactiveSwift

Submodule ReactiveSwift updated 69 files

Package.pins

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"autoPin": true,
3+
"pins": [
4+
{
5+
"package": "Argo",
6+
"reason": null,
7+
"repositoryURL": "https://github.com/thoughtbot/Argo.git",
8+
"version": "4.1.2"
9+
},
10+
{
11+
"package": "Curry",
12+
"reason": null,
13+
"repositoryURL": "https://github.com/thoughtbot/Curry.git",
14+
"version": "3.0.0"
15+
},
16+
{
17+
"package": "ReactiveSwift",
18+
"reason": null,
19+
"repositoryURL": "https://github.com/ReactiveCocoa/ReactiveSwift.git",
20+
"version": "2.0.0"
21+
},
22+
{
23+
"package": "Result",
24+
"reason": null,
25+
"repositoryURL": "https://github.com/antitypical/Result.git",
26+
"version": "3.2.3"
27+
},
28+
{
29+
"package": "Runes",
30+
"reason": null,
31+
"repositoryURL": "https://github.com/thoughtbot/Runes.git",
32+
"version": "4.1.0"
33+
}
34+
],
35+
"version": 1
36+
}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ let package = Package(
55
dependencies: [
66
.Package(url: "https://github.com/thoughtbot/Argo.git", versions: Version(4, 1, 2)..<Version(4, .max, .max)),
77
.Package(url: "https://github.com/thoughtbot/Curry.git", majorVersion: 3),
8-
.Package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", versions: Version(1, 1, 5)..<Version(1, .max, .max)),
8+
.Package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", majorVersion: 2),
99
]
1010
)

Sources/Tentacle/Client.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ extension URLSession {
4242
/// Returns a producer that will download a file using the given request. The file will be
4343
/// deleted after the producer terminates.
4444
internal func downloadFile(_ request: URLRequest) -> SignalProducer<URL, AnyError> {
45-
return SignalProducer { observer, disposable in
45+
return SignalProducer { observer, lifetime in
4646
let serialDisposable = SerialDisposable()
47-
let handle = disposable.add(serialDisposable)
47+
let handle = lifetime += serialDisposable
4848

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

5353
if let url = url {
5454
observer.send(value: url)
@@ -60,7 +60,7 @@ extension URLSession {
6060
}
6161
}
6262

63-
serialDisposable.inner = ActionDisposable {
63+
serialDisposable.inner = AnyDisposable {
6464
task.cancel()
6565
}
6666

@@ -196,10 +196,14 @@ public final class Client {
196196
.flatMap(.concat) { data, response -> SignalProducer<(Response, Any), Error> in
197197
let response = response as! HTTPURLResponse
198198
let headers = response.allHeaderFields as! [String:String]
199-
return SignalProducer
200-
.attempt {
201-
return JSONSerialization.deserializeJSON(data).mapError { Error.jsonDeserializationError($0.error) }
202-
}
199+
200+
// The explicitness is required to pick up
201+
// `init(_ action: @escaping () -> Result<Value, Error>)`
202+
// over `init(_ action: @escaping () -> Value)`.
203+
let producer: SignalProducer<Any, Error> = SignalProducer { () -> Result<Any, Error> in
204+
return JSONSerialization.deserializeJSON(data).mapError { Error.jsonDeserializationError($0.error) }
205+
}
206+
return producer
203207
.attemptMap { JSON in
204208
if response.statusCode == 404 {
205209
return .failure(.doesNotExist)

0 commit comments

Comments
 (0)