Skip to content

Commit

Permalink
Label the output and input ends of Signal.pipe()
Browse files Browse the repository at this point in the history
Attempts to clarify usage by being more explicit about the input and
output ends of the signal "pipe", and rewords the documentation accordingly.

See also: https://swift.org/documentation/api-design-guidelines/#label-closure-parameters.
  • Loading branch information
sharplet committed Dec 14, 2016
1 parent 8e649cb commit 4654e4c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Sources/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,20 @@ public final class Signal<Value, Error: Swift.Error> {
}
}

/// Create a Signal that will be controlled by sending events to the given
/// observer.
/// Create a `Signal` that will be controlled by sending events to an
/// input observer.
///
/// - note: The Signal will remain alive until a terminating event is sent
/// to the observer, or until it has no observer if it is not
/// retained.
/// - note: The `Signal` will remain alive until a terminating event is sent
/// to the input observer, or until it has no observers and there
/// are no strong references to it.
///
/// - parameters:
/// - disposable: An optional disposable to associate with the signal, and
/// to be disposed of when the signal terminates.
///
/// - returns: A tuple made of signal and observer.
public static func pipe(disposable: Disposable? = nil) -> (Signal, Observer) {
/// - returns: A tuple of `output: Signal`, the output end of the pipe,
/// and `input: Observer`, the input end of the pipe.
public static func pipe(disposable: Disposable? = nil) -> (output: Signal, input: Observer) {
var observer: Observer!
let signal = self.init { innerObserver in
observer = innerObserver
Expand Down

0 comments on commit 4654e4c

Please sign in to comment.