Skip to content

Commit 323a13d

Browse files
committed
Update the transforming Signal.Observer initializer.
1 parent 42af3e3 commit 323a13d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Sources/Observer.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ extension Signal {
3030
/// - parameters:
3131
/// - observer: The observer to transform.
3232
/// - transform: The transform.
33-
/// - disposable: The disposable to be disposed of when the transformation
34-
/// yields any terminal event that is not originated from the
35-
/// upstream.
33+
/// - disposable: The disposable to be disposed of when the `TransformerCore`
34+
/// yields any terminal event. If `observer` is a `Signal` input
35+
/// observer, this can be omitted.
3636
internal init<U, E: Swift.Error>(
3737
_ observer: Signal<U, E>.Observer,
3838
_ transform: @escaping Event.Transformation<U, E>,
39-
_ disposable: Disposable
39+
_ disposable: Disposable? = nil
4040
) {
4141
var hasDeliveredTerminalEvent = false
4242

@@ -46,7 +46,7 @@ extension Signal {
4646

4747
if event.isTerminating {
4848
hasDeliveredTerminalEvent = true
49-
disposable.dispose()
49+
disposable?.dispose()
5050
}
5151
}
5252
}

Sources/Signal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ extension Signal {
539539
/// - returns: A signal that forwards events yielded by the action.
540540
internal func flatMapEvent<U, E>(_ transform: @escaping Event.Transformation<U, E>) -> Signal<U, E> {
541541
return Signal<U, E> { observer in
542-
return self.observe(.init(observer, transform, NopDisposable.shared))
542+
return self.observe(Signal.Observer(observer, transform))
543543
}
544544
}
545545

Sources/SignalProducer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private final class TransformerCore<Value, Error: Swift.Error, SourceValue, Sour
336336
internal override func makeInstance() -> Instance {
337337
let product = source.makeInstance()
338338
let signal = Signal<Value, Error> { observer in
339-
return product.signal.observe(.init(observer, transform, product.interruptHandle))
339+
return product.signal.observe(Signal.Observer(observer, transform))
340340
}
341341

342342
return Instance(signal: signal,

0 commit comments

Comments
 (0)