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

Swift 4 #422

Merged
merged 5 commits into from
Jun 4, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: objective-c
osx_image: xcode8.3
before_install:
before_install:
- brew uninstall carthage
- HOMEBREW_NO_AUTO_UPDATE=1 brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6ae4f69a652fb0ecb102b0c9216378679a4f1b92/Formula/carthage.rb # 0.22.0
install: true
Expand All @@ -9,7 +9,7 @@ branches:
- master
# Credit: @Omnikron13, https://github.com/mojombo/semver/issues/32
- /^(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
- /^hotfix-(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
- /^hotfix-(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
script:
- script/build
xcode_workspace: ReactiveSwift.xcworkspace
Expand Down Expand Up @@ -55,6 +55,15 @@ jobs:
submodules: false
env:
- JOB=SWIFTPM_DARWIN
- before_install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
script:
- swift build
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nimble doesn't build with Swift 4, so this only builds for now. 😞

git:
submodules: false
env:
- JOB=SWIFT_4
- SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2017-05-29-a
- os: linux
language: generic
sudo: required
Expand All @@ -81,7 +90,7 @@ jobs:
- stage: deploy
before_install: true
script: skip
deploy:
deploy:
provider: script
script: script/gen-docs
on:
Expand Down
22 changes: 11 additions & 11 deletions Sources/EventLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum LoggingEvent {
}
}

private func defaultEventLog(identifier: String, event: String, fileName: String, functionName: String, lineNumber: Int) {
public func defaultEventLog(identifier: String, event: String, fileName: String, functionName: String, lineNumber: Int) {
print("[\(identifier)] \(event) fileName: \(fileName), functionName: \(functionName), lineNumber: \(lineNumber)")
}

Expand Down Expand Up @@ -69,10 +69,10 @@ extension Signal {

return self.on(
failed: log(.failed),
completed: log(.completed),
interrupted: log(.interrupted),
terminated: log(.terminated),
disposed: log(.disposed),
completed: log(.completed) as ((()) -> Void)?,
Copy link
Member

Choose a reason for hiding this comment

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

Ugh

interrupted: log(.interrupted) as ((()) -> Void)?,
terminated: log(.terminated) as ((()) -> Void)?,
disposed: log(.disposed) as ((()) -> Void)?,
value: log(.value)
)
}
Expand Down Expand Up @@ -106,13 +106,13 @@ extension SignalProducer {
}

return self.on(
starting: log(.starting),
started: log(.started),
starting: log(.starting) as ((()) -> Void)?,
started: log(.started) as ((()) -> Void)?,
failed: log(.failed),
completed: log(.completed),
interrupted: log(.interrupted),
terminated: log(.terminated),
disposed: log(.disposed),
completed: log(.completed) as ((()) -> Void)?,
interrupted: log(.interrupted) as ((()) -> Void)?,
terminated: log(.terminated) as ((()) -> Void)?,
disposed: log(.disposed) as ((()) -> Void)?,
value: log(.value)
)
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ extension Signal {
private let action: (ContiguousArray<Any>) -> Void

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

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

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

Expand All @@ -2511,8 +2511,8 @@ extension Signal {
/// - returns: A signal which forwards the values from `self` until the given action
/// fails.
public func attempt(_ action: @escaping (Value) -> Result<(), Error>) -> Signal<Value, Error> {
return attemptMap { value in
return action(value).map {
return attemptMap { value -> Result<Value, Error> in
return action(value).map { _ -> Value in
return value
}
}
Expand Down