Skip to content

Commit 0dbfce3

Browse files
authored
Merge pull request #428 from ReactiveCocoa/swift-4-fix
Fixes for Swift 4 2017-05-29 development snapshot.
2 parents c70e5cd + 7678eb9 commit 0dbfce3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Sources/SignalProducer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public struct SignalProducer<Value, Error: Swift.Error> {
7979
/// - parameters:
8080
/// - startHandler: A closure that accepts observer and a disposable.
8181
public init(_ startHandler: @escaping (Signal<Value, Error>.Observer, Lifetime) -> Void) {
82-
self.init { _ -> Instance in
82+
self.init { () -> Instance in
8383
let disposable = CompositeDisposable()
8484
let (signal, observer) = Signal<Value, Error>.pipe(disposable: disposable)
8585
let observerDidSetup = { startHandler(observer, Lifetime(disposable)) }
@@ -427,7 +427,7 @@ extension SignalProducer {
427427
/// - returns: A signal producer that applies signal's operator to every
428428
/// created signal.
429429
public func lift<U, F>(_ transform: @escaping (Signal<Value, Error>) -> Signal<U, F>) -> SignalProducer<U, F> {
430-
return SignalProducer<U, F> { _ -> SignalProducer<U, F>.Instance in
430+
return SignalProducer<U, F> { () -> SignalProducer<U, F>.Instance in
431431
// Transform the `Signal`, and pass through the `didCreate` side effect and
432432
// the interruptHandle.
433433
let instance = self.producer.builder()
@@ -463,7 +463,7 @@ extension SignalProducer {
463463

464464
private func lift<U, F, V, G>(leftFirst: Bool, _ transform: @escaping (Signal<Value, Error>) -> (Signal<U, F>) -> Signal<V, G>) -> (SignalProducer<U, F>) -> SignalProducer<V, G> {
465465
return { otherProducer in
466-
return SignalProducer<V, G> { _ -> SignalProducer<V, G>.Instance in
466+
return SignalProducer<V, G> { () -> SignalProducer<V, G>.Instance in
467467
let left = self.producer.builder()
468468
let right = otherProducer.builder()
469469

@@ -1466,7 +1466,7 @@ extension SignalProducer {
14661466
disposed: (() -> Void)? = nil,
14671467
value: ((Value) -> Void)? = nil
14681468
) -> SignalProducer<Value, Error> {
1469-
return SignalProducer { _ -> Instance in
1469+
return SignalProducer { () -> Instance in
14701470
let instance = self.producer.builder()
14711471
let signal = instance.producedSignal.on(event: event,
14721472
failed: failed,

Sources/UnidirectionalBinding.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ infix operator <~ : BindingPrecedence
1515
// public protocol BindingSource: SignalProducerConvertible where Error == NoError {}
1616

1717
/// Describes a source which can be bound.
18-
public protocol BindingSource: SignalProducerConvertible {}
18+
public protocol BindingSource: SignalProducerConvertible {
19+
// FIXME: Swift 4 compiler regression.
20+
// All requirements are replicated to workaround the type checker issue.
21+
// https://bugs.swift.org/browse/SR-5090
1922

23+
associatedtype Value
24+
associatedtype Error
25+
26+
var producer: SignalProducer<Value, Error> { get }
27+
}
2028
extension Signal: BindingSource {}
2129
extension SignalProducer: BindingSource {}
2230

0 commit comments

Comments
 (0)