Skip to content

Commit c70e5cd

Browse files
authored
Merge pull request #422 from ReactiveCocoa/swift-4
Swift 4
2 parents 2c6de59 + 1a9e8d3 commit c70e5cd

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

.travis.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: objective-c
22
osx_image: xcode8.3
3-
before_install:
3+
before_install:
44
- brew uninstall carthage
55
- HOMEBREW_NO_AUTO_UPDATE=1 brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6ae4f69a652fb0ecb102b0c9216378679a4f1b92/Formula/carthage.rb # 0.22.0
66
install: true
@@ -9,7 +9,7 @@ branches:
99
- master
1010
# Credit: @Omnikron13, https://github.com/mojombo/semver/issues/32
1111
- /^(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
12-
- /^hotfix-(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
12+
- /^hotfix-(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
1313
script:
1414
- script/build
1515
xcode_workspace: ReactiveSwift.xcworkspace
@@ -55,6 +55,15 @@ jobs:
5555
submodules: false
5656
env:
5757
- JOB=SWIFTPM_DARWIN
58+
- before_install:
59+
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
60+
script:
61+
- swift build
62+
git:
63+
submodules: false
64+
env:
65+
- JOB=SWIFT_4
66+
- SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2017-05-29-a
5867
- os: linux
5968
language: generic
6069
sudo: required
@@ -81,7 +90,7 @@ jobs:
8190
- stage: deploy
8291
before_install: true
8392
script: skip
84-
deploy:
93+
deploy:
8594
provider: script
8695
script: script/gen-docs
8796
on:

Sources/EventLogger.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum LoggingEvent {
2727
}
2828
}
2929

30-
private func defaultEventLog(identifier: String, event: String, fileName: String, functionName: String, lineNumber: Int) {
30+
public func defaultEventLog(identifier: String, event: String, fileName: String, functionName: String, lineNumber: Int) {
3131
print("[\(identifier)] \(event) fileName: \(fileName), functionName: \(functionName), lineNumber: \(lineNumber)")
3232
}
3333

@@ -69,10 +69,10 @@ extension Signal {
6969

7070
return self.on(
7171
failed: log(.failed),
72-
completed: log(.completed),
73-
interrupted: log(.interrupted),
74-
terminated: log(.terminated),
75-
disposed: log(.disposed),
72+
completed: log(.completed) as ((()) -> Void)?,
73+
interrupted: log(.interrupted) as ((()) -> Void)?,
74+
terminated: log(.terminated) as ((()) -> Void)?,
75+
disposed: log(.disposed) as ((()) -> Void)?,
7676
value: log(.value)
7777
)
7878
}
@@ -106,13 +106,13 @@ extension SignalProducer {
106106
}
107107

108108
return self.on(
109-
starting: log(.starting),
110-
started: log(.started),
109+
starting: log(.starting) as ((()) -> Void)?,
110+
started: log(.started) as ((()) -> Void)?,
111111
failed: log(.failed),
112-
completed: log(.completed),
113-
interrupted: log(.interrupted),
114-
terminated: log(.terminated),
115-
disposed: log(.disposed),
112+
completed: log(.completed) as ((()) -> Void)?,
113+
interrupted: log(.interrupted) as ((()) -> Void)?,
114+
terminated: log(.terminated) as ((()) -> Void)?,
115+
disposed: log(.disposed) as ((()) -> Void)?,
116116
value: log(.value)
117117
)
118118
}

Sources/Signal.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,7 @@ extension Signal {
20892089
private let action: (ContiguousArray<Any>) -> Void
20902090

20912091
private var hasCompletedAndEmptiedSignal: Bool {
2092-
return Swift.zip(values, isCompleted).contains(where: { $0.isEmpty && $1 })
2092+
return Swift.zip(values, isCompleted).contains(where: { $0.0.isEmpty && $0.1 })
20932093
}
20942094

20952095
private var canEmit: Bool {
@@ -2489,7 +2489,7 @@ extension Signal where Value == Bool {
24892489
///
24902490
/// - returns: A signal that emits the logical AND results.
24912491
public func and(_ signal: Signal<Value, Error>) -> Signal<Value, Error> {
2492-
return self.combineLatest(with: signal).map { $0 && $1 }
2492+
return self.combineLatest(with: signal).map { $0.0 && $0.1 }
24932493
}
24942494

24952495
/// Create a signal that computes a logical OR between the latest values of `self`
@@ -2500,7 +2500,7 @@ extension Signal where Value == Bool {
25002500
///
25012501
/// - returns: A signal that emits the logical OR results.
25022502
public func or(_ signal: Signal<Value, Error>) -> Signal<Value, Error> {
2503-
return self.combineLatest(with: signal).map { $0 || $1 }
2503+
return self.combineLatest(with: signal).map { $0.0 || $0.1 }
25042504
}
25052505
}
25062506

@@ -2515,8 +2515,8 @@ extension Signal {
25152515
/// - returns: A signal which forwards the values from `self` until the given action
25162516
/// fails.
25172517
public func attempt(_ action: @escaping (Value) -> Result<(), Error>) -> Signal<Value, Error> {
2518-
return attemptMap { value in
2519-
return action(value).map {
2518+
return attemptMap { value -> Result<Value, Error> in
2519+
return action(value).map { _ -> Value in
25202520
return value
25212521
}
25222522
}

0 commit comments

Comments
 (0)