ObservableType

public protocol ObservableType : ObservableConvertibleType

Represents a push style sequence.

  • subscribe(_:) Default implementation

    Subscribes observer to receive events for this sequence.

    Grammar

    Next* (Error | Completed)?

    • sequences can produce zero or more elements so zero or more Next events can be sent to observer
    • once an Error or Completed event is sent, the sequence terminates and can’t produce any other elements

    It is possible that events are sent from different threads, but no two events can be sent concurrently to observer.

    Resource Management

    When sequence sends Complete or Error event all internal resources that compute sequence elements will be freed.

    To cancel production of sequence elements and free resources immediately, call dispose on returned subscription.

    Default Implementation

    Subscribes an event handler to an observable sequence.

    Declaration

    Swift

    func subscribe<Observer>(_ observer: Observer) -> Disposable where Observer : ObserverType, Self.Element == Observer.Element

    Return Value

    Subscription for observer that can be used to cancel production of sequence elements and free resources.

  • Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    public func subscribe<Object: AnyObject>(
        with object: Object,
        onNext: ((Object, Element) -> Void)? = nil,
        onError: ((Object, Swift.Error) -> Void)? = nil,
        onCompleted: ((Object) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onNext

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    onDisposed

    Action to invoke upon any type of termination of sequence (if the sequence has gracefully completed, errored, or if the generation is canceled by disposing subscription).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

    Declaration

    Swift

    public func subscribe(
        onNext: ((Element) -> Void)? = nil,
        onError: ((Swift.Error) -> Void)? = nil,
        onCompleted: (() -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    onDisposed

    Action to invoke upon any type of termination of sequence (if the sequence has gracefully completed, errored, or if the generation is canceled by disposing subscription).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • asObservable() Extension method

    Default implementation of converting ObservableType to Observable.

    Declaration

    Swift

    public func asObservable() -> Observable<Element>
  • amb(_:) Extension method

    Propagates the observable sequence that reacts first.

    Declaration

    Swift

    public static func amb<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence that surfaces any of the given sequences, whichever reacted first.

  • amb(_:) Extension method

    Propagates the observable sequence that reacts first.

    Declaration

    Swift

    public func amb<O2: ObservableType>
        (_ right: O2)
        -> Observable<Element> where O2.Element == Element

    Parameters

    right

    Second observable sequence.

    Return Value

    An observable sequence that surfaces either of the given sequences, whichever reacted first.

  • Projects each element of an observable sequence into a buffer that’s sent out when either it’s full or a given amount of time has elapsed, using the specified scheduler to run timers.

    A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.

    Declaration

    Swift

    public func buffer(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)
        -> Observable<[Element]>

    Parameters

    timeSpan

    Maximum time length of a buffer.

    count

    Maximum element count of a buffer.

    scheduler

    Scheduler to run buffering timers on.

    Return Value

    An observable sequence of buffers.

  • catch(_:) Extension method

    Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    public func `catch`(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the elements produced by the handler’s resulting observable sequence in case an error occurred.

  • catchError(_:) Extension method

    Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catch(_:﹚")
    public func catchError(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the elements produced by the handler’s resulting observable sequence in case an error occurred.

  • catchAndReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    public func catchAndReturn(_ element: Element)
        -> Observable<Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchErrorJustReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catchAndReturn(_:﹚")
    public func catchErrorJustReturn(_ element: Element)
        -> Observable<Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchError(_:) Extension method

    Continues an observable sequence that is terminated by an error with the next observable sequence.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catch(onSuccess:onFailure:onDisposed:﹚")
    public static func catchError<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.

  • catch(sequence:) Extension method

    Continues an observable sequence that is terminated by an error with the next observable sequence.

    Declaration

    Swift

    public static func `catch`<Sequence: Swift.Sequence>(sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.

  • retry() Extension method

    Repeats the source observable sequence until it successfully terminates.

    This could potentially create an infinite sequence.

    Declaration

    Swift

    public func retry() -> Observable<Element>

    Return Value

    Observable sequence to repeat until it successfully terminates.

  • retry(_:) Extension method

    Repeats the source observable sequence the specified number of times in case of an error or until it successfully terminates.

    If you encounter an error and want it to retry once, then you must use retry(2)

    Declaration

    Swift

    public func retry(_ maxAttemptCount: Int)
        -> Observable<Element>

    Parameters

    maxAttemptCount

    Maximum number of times to repeat the sequence.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>
        where Collection.Element: ObservableType

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • combineLatest(_:) Extension method

    Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>
        where Collection.Element: ObservableType, Collection.Element.Element == Element

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType>
        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)
            -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • compactMap(_:) Extension method

    Projects each element of an observable sequence into an optional form and filters all optional results.

    Declaration

    Swift

    public func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)
        -> Observable<Result>

    Parameters

    transform

    A transform function to apply to each source element and which returns an element or nil.

    Return Value

    An observable sequence whose elements are the result of filtering the transform function for each element of the source.

  • concat(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    public func concat<Source>(_ second: Source) -> Observable<Element> where Source : ObservableConvertibleType, Self.Element == Source.Element

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

    This operator has tail recursive optimizations that will prevent stack overflow.

    Optimizations will be performed in cases equivalent to following:

    [1, [2, [3, …..].concat()].concat].concat()

    Declaration

    Swift

    public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

    This operator has tail recursive optimizations that will prevent stack overflow.

    Optimizations will be performed in cases equivalent to following:

    [1, [2, [3, …..].concat()].concat].concat()

    Declaration

    Swift

    public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Observable<Element>
        where Collection.Element == Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

    This operator has tail recursive optimizations that will prevent stack overflow.

    Optimizations will be performed in cases equivalent to following:

    [1, [2, [3, …..].concat()].concat].concat()

    Declaration

    Swift

    public static func concat(_ sources: Observable<Element>...) -> Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

create

  • create(_:) Extension method

    Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    public static func create(_ subscribe: @escaping (AnyObserver<Element>) -> Disposable) -> Observable<Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

  • debounce(_:scheduler:) Extension method

    Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.

    Declaration

    Swift

    public func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

  • Prints received events for all observers on standard output.

    Declaration

    Swift

    public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function)
        -> Observable<Element>

    Parameters

    identifier

    Identifier that is printed together with event description to standard output.

    trimOutput

    Should output be trimmed to max 40 characters.

    Return Value

    An observable sequence whose events are printed to standard output.

  • ifEmpty(default:) Extension method

    Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.

    Declaration

    Swift

    public func ifEmpty(default: Element) -> Observable<Element>

    Parameters

    default

    Default element to be sent if the source does not emit any elements

    Return Value

    An observable sequence which emits default element end completes in case the original sequence is empty

  • deferred(_:) Extension method

    Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.

    Declaration

    Swift

    public static func deferred(_ observableFactory: @escaping () throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    observableFactory

    Observable factory function to invoke for each observer that subscribes to the resulting sequence.

    Return Value

    An observable sequence whose observers trigger an invocation of the given observable factory function.

  • delay(_:scheduler:) Extension method

    Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed.

    Declaration

    Swift

    public func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time shift of the source by.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    the source Observable shifted in time by the specified delay.

  • Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.

    Declaration

    Swift

    public func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time shift of the subscription.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    Time-shifted sequence.

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.

    Declaration

    Swift

    public func distinctUntilChanged<Key: Equatable>(_ keySelector: @escaping (Element) throws -> Key)
        -> Observable<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the comparer.

    Declaration

    Swift

    public func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on comparer, from the source sequence.

  • Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.

    Declaration

    Swift

    public func distinctUntilChanged<K>(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool)
        -> Observable<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.

  • distinctUntilChanged(at:) Extension method

    Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.

    Declaration

    Swift

    public func distinctUntilChanged<Property: Equatable>(at keyPath: KeyPath<Element, Property>) ->
        Observable<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator on the provided key path

  • Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    public func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, afterError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil)
        -> Observable<Element>

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    afterNext

    Action to invoke for each element after the observable has passed an onNext event along to its downstream.

    onError

    Action to invoke upon errored termination of the observable sequence.

    afterError

    Action to invoke after errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    afterCompleted

    Action to invoke after graceful termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    onDispose

    Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.

    Return Value

    The source sequence with the side-effecting behavior applied.

  • elementAt(_:) Extension method

    Returns a sequence emitting only element n emitted by an Observable

    Declaration

    Swift

    @available(*, deprecated, renamed: "element(at:﹚")
    public func elementAt(_ index: Int)
        -> Observable<Element>

    Parameters

    index

    The index of the required element (starting from 0).

    Return Value

    An observable sequence that emits the desired element as its own sole emission.

  • element(at:) Extension method

    Returns a sequence emitting only element n emitted by an Observable

    Declaration

    Swift

    public func element(at index: Int)
        -> Observable<Element>

    Parameters

    index

    The index of the required element (starting from 0).

    Return Value

    An observable sequence that emits the desired element as its own sole emission.

  • empty() Extension method

    Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

    Declaration

    Swift

    public static func empty() -> Observable<Element>

    Return Value

    An observable sequence with no elements.

  • enumerated() Extension method

    Enumerates the elements of an observable sequence.

    Declaration

    Swift

    public func enumerated()
        -> Observable<(index: Int, element: Element)>

    Return Value

    An observable sequence that contains tuples of source sequence elements and their indexes.

  • error(_:) Extension method

    Returns an observable sequence that terminates with an error.

    Declaration

    Swift

    public static func error(_ error: Swift.Error) -> Observable<Element>

    Return Value

    The observable sequence that terminates with specified error.

  • filter(_:) Extension method

    Filters the elements of an observable sequence based on a predicate.

    Declaration

    Swift

    public func filter(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that contains elements from the input sequence that satisfy the condition.

  • ignoreElements() Extension method

    Skips elements and completes (or errors) when the observable sequence completes (or errors). Equivalent to filter that always returns false.

    Declaration

    Swift

    public func ignoreElements()
        -> Observable<Never>

    Return Value

    An observable sequence that skips all elements of the source sequence.

  • Generates an observable sequence by running a state-driven loop producing the sequence’s elements, using the specified scheduler to run the loop send out observer messages.

    Declaration

    Swift

    public static func generate(initialState: Element, condition: @escaping (Element) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (Element) throws -> Element) -> Observable<Element>

    Parameters

    initialState

    Initial state.

    condition

    Condition to terminate generation (upon returning false).

    iterate

    Iteration step function.

    scheduler

    Scheduler on which to run the generator loop.

    Return Value

    The generated sequence.

  • groupBy(keySelector:) Extension method

    Undocumented

    Declaration

    Swift

    public func groupBy<Key: Hashable>(keySelector: @escaping (Element) throws -> Key)
        -> Observable<GroupedObservable<Key, Element>>
  • just(_:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    public static func just(_ element: Element) -> Observable<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    Return Value

    An observable sequence containing the single specified element.

  • just(_:scheduler:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Observable<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    scheduler

    Scheduler to send the single element on.

    Return Value

    An observable sequence containing the single specified element.

  • map(_:) Extension method

    Projects each element of an observable sequence into a new form.

    Declaration

    Swift

    public func map<Result>(_ transform: @escaping (Element) throws -> Result)
        -> Observable<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source.

  • materialize() Extension method

    Convert any Observable into an Observable of its events.

    Declaration

    Swift

    public func materialize() -> Observable<Event<Element>>

    Return Value

    An observable sequence that wraps events in an Event. The returned Observable never errors, but it does complete after observing all of the events of the underlying Observable.

  • flatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    public func flatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • flatMapFirst(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. If element is received while there is some projected observable sequence being merged it will simply be ignored.

    Declaration

    Swift

    public func flatMapFirst<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to element that was observed while no observable is executing in parallel.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.

  • merge(_:) Extension method

    Merges elements from all observable sequences from collection into a single observable sequence.

    Declaration

    Swift

    public static func merge<Collection>(_ sources: Collection) -> Observable<Element> where Collection : Collection, Collection.Element == Observable<Self.Element>

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(_:) Extension method

    Merges elements from all observable sequences from array into a single observable sequence.

    Declaration

    Swift

    public static func merge(_ sources: [Observable<Element>]) -> Observable<Element>

    Parameters

    sources

    Array of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(_:) Extension method

    Merges elements from all observable sequences into a single observable sequence.

    Declaration

    Swift

    public static func merge(_ sources: Observable<Element>...) -> Observable<Element>

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

concatMap

  • concatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    public func concatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Return Value

    An observable sequence that contains the elements of each observed inner sequence, in sequential order.

  • multicast(_:selector:) Extension method

    Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function.

    Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function’s invocation.

    For specializations with fixed subject types, see publish and replay.

    Declaration

    Swift

    public func multicast<Subject: SubjectType, Result>(_ subjectSelector: @escaping () throws -> Subject, selector: @escaping (Observable<Subject.Element>) throws -> Observable<Result>)
        -> Observable<Result> where Subject.Observer.Element == Element

    Parameters

    subjectSelector

    Factory function to create an intermediate subject through which the source sequence’s elements will be multicast to the selector function.

    selector

    Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.

    Return Value

    An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.

  • publish() Extension method

    Returns a connectable observable sequence that shares a single subscription to the underlying sequence.

    This operator is a specialization of multicast using a PublishSubject.

    Declaration

    Swift

    public func publish() -> ConnectableObservable<Element>

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • replay(_:) Extension method

    Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize elements.

    This operator is a specialization of multicast using a ReplaySubject.

    Declaration

    Swift

    public func replay(_ bufferSize: Int)
        -> ConnectableObservable<Element>

    Parameters

    bufferSize

    Maximum element count of the replay buffer.

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • replayAll() Extension method

    Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements.

    This operator is a specialization of multicast using a ReplaySubject.

    Declaration

    Swift

    public func replayAll()
        -> ConnectableObservable<Element>

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • multicast(_:) Extension method

    Multicasts the source sequence notifications through the specified subject to the resulting connectable observable.

    Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable.

    For specializations with fixed subject types, see publish and replay.

    Declaration

    Swift

    public func multicast<Subject: SubjectType>(_ subject: Subject)
        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element

    Parameters

    subject

    Subject to push source elements into.

    Return Value

    A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.

  • multicast(makeSubject:) Extension method

    Multicasts the source sequence notifications through an instantiated subject to the resulting connectable observable.

    Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable.

    Subject is cleared on connection disposal or in case source sequence produces terminal event.

    Declaration

    Swift

    public func multicast<Subject: SubjectType>(makeSubject: @escaping () -> Subject)
        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element

    Parameters

    makeSubject

    Factory function used to instantiate a subject for each connection.

    Return Value

    A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.

  • never() Extension method

    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    public static func never() -> Observable<Element>

    Return Value

    An observable sequence whose observers will never get called.

  • observe(on:) Extension method

    Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

    This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects that require to be run on a scheduler, use subscribeOn.

    Declaration

    Swift

    public func observe(on scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • observeOn(_:) Extension method

    Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

    This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects that require to be run on a scheduler, use subscribeOn.

    Declaration

    Swift

    @available(*, deprecated, renamed: "observe(on:﹚")
    public func observeOn(_ scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • from(optional:) Extension method

    Converts a optional to an observable sequence.

    Declaration

    Swift

    public static func from(optional: Element?) -> Observable<Element>

    Parameters

    optional

    Optional element in the resulting observable sequence.

    Return Value

    An observable sequence containing the wrapped value or not from given optional.

  • from(optional:scheduler:) Extension method

    Converts a optional to an observable sequence.

    Declaration

    Swift

    public static func from(optional: Element?, scheduler: ImmediateSchedulerType) -> Observable<Element>

    Parameters

    optional

    Optional element in the resulting observable sequence.

    scheduler

    Scheduler to send the optional element on.

    Return Value

    An observable sequence containing the wrapped value or not from given optional.

  • Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.

    For aggregation behavior with incremental intermediate results, see scan.

    Declaration

    Swift

    public func reduce<A, Result>(_ seed: A, accumulator: @escaping (A, Element) throws -> A, mapResult: @escaping (A) throws -> Result)
        -> Observable<Result>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    A accumulator function to be invoked on each element.

    mapResult

    A function to transform the final accumulator value into the result value.

    Return Value

    An observable sequence containing a single element with the final accumulator value.

  • reduce(_:accumulator:) Extension method

    Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.

    For aggregation behavior with incremental intermediate results, see scan.

    Declaration

    Swift

    public func reduce<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    A accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing a single element with the final accumulator value.

  • repeatElement(_:scheduler:) Extension method

    Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.

    Declaration

    Swift

    public static func repeatElement(_ element: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    element

    Element to repeat.

    scheduler

    Scheduler to run the producer loop on.

    Return Value

    An observable sequence that repeats the given element infinitely.

  • retry(when:) Extension method

    Repeats the source observable sequence on error when the notifier emits a next value. If the source observable errors and the notifier completes, it will complete the source sequence.

    Declaration

    Swift

    public func retry<TriggerObservable: ObservableType, Error: Swift.Error>(when notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)
        -> Observable<Element>

    Parameters

    notificationHandler

    A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retryWhen(_:) Extension method

    Repeats the source observable sequence on error when the notifier emits a next value. If the source observable errors and the notifier completes, it will complete the source sequence.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    public func retryWhen<TriggerObservable: ObservableType, Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)
        -> Observable<Element>

    Parameters

    notificationHandler

    A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retry(when:) Extension method

    Repeats the source observable sequence on error when the notifier emits a next value. If the source observable errors and the notifier completes, it will complete the source sequence.

    Declaration

    Swift

    public func retry<TriggerObservable: ObservableType>(when notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)
        -> Observable<Element>

    Parameters

    notificationHandler

    A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retryWhen(_:) Extension method

    Repeats the source observable sequence on error when the notifier emits a next value. If the source observable errors and the notifier completes, it will complete the source sequence.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    public func retryWhen<TriggerObservable: ObservableType>(_ notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)
        -> Observable<Element>

    Parameters

    notificationHandler

    A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • sample(_:defaultValue:) Extension method

    Samples the source observable sequence using a sampler observable sequence producing sampling ticks.

    Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.

    In case there were no new elements between sampler ticks, you may provide a default value to be emitted, instead to the resulting sequence otherwise no element is sent.

    Declaration

    Swift

    public func sample<Source: ObservableType>(_ sampler: Source, defaultValue: Element? = nil)
        -> Observable<Element>

    Parameters

    sampler

    Sampling tick sequence.

    defaultValue

    a value to return if there are no new elements between sampler ticks

    Return Value

    Sampled observable sequence.

  • scan(into:accumulator:) Extension method

    Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

    For aggregation behavior with no intermediate results, see reduce.

    Declaration

    Swift

    public func scan<A>(into seed: A, accumulator: @escaping (inout A, Element) throws -> Void)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

  • scan(_:accumulator:) Extension method

    Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

    For aggregation behavior with no intermediate results, see reduce.

    Declaration

    Swift

    public func scan<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

of

  • of(_:scheduler:) Extension method

    This method creates a new Observable instance with a variable number of elements.

    Declaration

    Swift

    public static func of(_ elements: Element..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    elements

    Elements to generate.

    scheduler

    Scheduler to send elements on. If nil, elements are sent immediately on subscription.

    Return Value

    The observable sequence whose elements are pulled from the given arguments.

  • from(_:scheduler:) Extension method

    Converts an array to an observable sequence.

    Declaration

    Swift

    public static func from(_ array: [Element], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Return Value

    The observable sequence whose elements are pulled from the given enumerable sequence.

  • from(_:scheduler:) Extension method

    Converts a sequence to an observable sequence.

    Declaration

    Swift

    public static func from<Sequence>(_ sequence: Sequence, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> where Sequence : Sequence, Self.Element == Sequence.Element

    Return Value

    The observable sequence whose elements are pulled from the given enumerable sequence.

  • share(replay:scope:) Extension method

    Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays elements in buffer.

    This operator is equivalent to:

    • .whileConnected // Each connection will have it's own subject instance to store replay events. // Connections will be isolated from each another. source.multicast(makeSubject: { Replay.create(bufferSize: replay) }).refCount()
    • .forever // One subject will store replay events for all connections to source. // Connections won't be isolated from each another. source.multicast(Replay.create(bufferSize: replay)).refCount()

    It uses optimized versions of the operators for most common operations.

    Declaration

    Swift

    public func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected)
        -> Observable<Element>

    Parameters

    replay

    Maximum element count of the replay buffer.

    scope

    Lifetime scope of sharing subject. For more information see SubjectLifetimeScope enum.

    Return Value

    An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.

  • single() Extension method

    The single operator is similar to first, but throws a RxError.noElements or RxError.moreThanOneElement if the source Observable does not emit exactly one element before successfully completing.

    Declaration

    Swift

    public func single()
        -> Observable<Element>

    Return Value

    An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.

  • single(_:) Extension method

    The single operator is similar to first, but throws a RxError.NoElements or RxError.MoreThanOneElement if the source Observable does not emit exactly one element before successfully completing.

    Declaration

    Swift

    public func single(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.

  • skip(_:) Extension method

    Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.

    Declaration

    Swift

    public func skip(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    The number of elements to skip before returning the remaining elements.

    Return Value

    An observable sequence that contains the elements that occur after the specified index in the input sequence.

  • skip(_:scheduler:) Extension method

    Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    public func skip(_ duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for skipping elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements skipped during the specified duration from the start of the source sequence.

  • skip(until:) Extension method

    Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

    Declaration

    Swift

    public func skip<Source: ObservableType>(until other: Source)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that starts propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.

  • skipUntil(_:) Extension method

    Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "skip(until:﹚")
    public func skipUntil<Source: ObservableType>(_ other: Source)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that starts propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.

  • skip(while:) Extension method

    Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

    Declaration

    Swift

    public func skip(while predicate: @escaping (Element) throws -> Bool) -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.

  • skipWhile(_:) Extension method

    Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

    Declaration

    Swift

    @available(*, deprecated, renamed: "skip(while:﹚")
    public func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.

  • startWith(_:) Extension method

    Prepends a sequence of values to an observable sequence.

    Declaration

    Swift

    public func startWith(_ elements: Element ...)
        -> Observable<Element>

    Parameters

    elements

    Elements to prepend to the specified sequence.

    Return Value

    The source sequence prepended with the specified values.

  • subscribe(on:) Extension method

    Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler.

    This operation is not commonly used.

    This only performs the side-effects of subscription and unsubscription on the specified scheduler.

    In order to invoke observer callbacks on a scheduler, use observeOn.

    Declaration

    Swift

    public func subscribe(on scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • subscribeOn(_:) Extension method

    Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler.

    This operation is not commonly used.

    This only performs the side-effects of subscription and unsubscription on the specified scheduler.

    In order to invoke observer callbacks on a scheduler, use observeOn.

    Declaration

    Swift

    @available(*, deprecated, renamed: "subscribe(on:﹚")
    public func subscribeOn(_ scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • flatMapLatest(_:) Extension method

    Projects each element of an observable sequence into a new sequence of observable sequences and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

    It is a combination of map + switchLatest operator

    Declaration

    Swift

    public func flatMapLatest<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.

  • flatMapLatest(_:) Extension method

    Projects each element of an observable sequence into a new sequence of observable sequences and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

    It is a combination of map + switchLatest operator

    Declaration

    Swift

    public func flatMapLatest<Source: InfallibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Infallible<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.

  • ifEmpty(switchTo:) Extension method

    Returns the elements of the specified sequence or switchTo sequence if the sequence is empty.

    Declaration

    Swift

    public func ifEmpty(switchTo other: Observable<Element>) -> Observable<Element>

    Parameters

    switchTo

    Observable sequence being returned when source sequence is empty.

    Return Value

    Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.

  • take(_:) Extension method

    Returns a specified number of contiguous elements from the start of an observable sequence.

    Declaration

    Swift

    public func take(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    The number of elements to return.

    Return Value

    An observable sequence that contains the specified number of elements from the start of the input sequence.

  • take(for:scheduler:) Extension method

    Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    public func take(for duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for taking elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements taken during the specified duration from the start of the source sequence.

  • take(_:scheduler:) Extension method

    Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(for:scheduler:﹚")
    public func take(_ duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for taking elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements taken during the specified duration from the start of the source sequence.

  • takeLast(_:) Extension method

    Returns a specified number of contiguous elements from the end of an observable sequence.

    This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.

    Declaration

    Swift

    public func takeLast(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    Number of elements to take from the end of the source sequence.

    Return Value

    An observable sequence containing the specified number of elements from the end of the source sequence.

  • take(until:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    public func take<Source: ObservableType>(until other: Source)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • take(until:behavior:) Extension method

    Returns elements from an observable sequence until the specified condition is true.

    Declaration

    Swift

    public func take(until predicate: @escaping (Element) throws -> Bool,
                     behavior: TakeBehavior = .exclusive)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    behavior

    Whether or not to include the last element matching the predicate. Defaults to exclusive.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.

  • take(while:behavior:) Extension method

    Returns elements from an observable sequence as long as a specified condition is true.

    Declaration

    Swift

    public func take(while predicate: @escaping (Element) throws -> Bool,
                     behavior: TakeBehavior = .exclusive)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

  • takeUntil(_:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(until:﹚")
    public func takeUntil<Source: ObservableType>(_ other: Source)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • takeUntil(_:predicate:) Extension method

    Returns elements from an observable sequence until the specified condition is true.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(until:behavior:﹚")
    public func takeUntil(_ behavior: TakeBehavior,
                          predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    behavior

    Whether or not to include the last element matching the predicate.

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.

  • takeWhile(_:) Extension method

    Returns elements from an observable sequence as long as a specified condition is true.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(while:﹚")
    public func takeWhile(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

  • Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.

    This operator makes sure that no two elements are emitted in less then dueTime.

    Declaration

    Swift

    public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    latest

    Should latest element received in a dueTime wide time window since last element emission be emitted.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

  • timeout(_:scheduler:) Extension method

    Applies a timeout policy for each element in the observable sequence. If the next element isn’t received within the specified timeout duration starting from its predecessor, a TimeoutError is propagated to the observer.

    Declaration

    Swift

    public func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    An observable sequence with a RxError.timeout in case of a timeout.

  • timeout(_:other:scheduler:) Extension method

    Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn’t received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

    Declaration

    Swift

    public func timeout<Source: ObservableConvertibleType>(_ dueTime: RxTimeInterval, other: Source, scheduler: SchedulerType)
        -> Observable<Element> where Element == Source.Element

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    other

    Sequence to return in case of a timeout.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    The source sequence switching to the other sequence in case of a timeout.

  • toArray() Extension method

    Converts an Observable into a Single that emits the whole sequence as a single array and then terminates.

    For aggregation behavior see reduce.

    Declaration

    Swift

    public func toArray()
        -> Single<[Element]>

    Return Value

    A Single sequence containing all the emitted elements as array.

  • using(_:observableFactory:) Extension method

    Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

    Declaration

    Swift

    public static func using<Resource>(_ resourceFactory: @escaping () throws -> Resource, observableFactory: @escaping (Resource) throws -> Observable<Element>) -> Observable<Element> where Resource : Disposable

    Parameters

    resourceFactory

    Factory function to obtain a resource object.

    observableFactory

    Factory function to obtain an observable sequence that depends on the obtained resource.

    Return Value

    An observable sequence whose lifetime controls the lifetime of the dependent resource object.

  • Projects each element of an observable sequence into a window that is completed when either it’s full or a given amount of time has elapsed.

    Declaration

    Swift

    public func window(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)
        -> Observable<Observable<Element>>

    Parameters

    timeSpan

    Maximum time length of a window.

    count

    Maximum element count of a window.

    scheduler

    Scheduler to run windowing timers on.

    Return Value

    An observable sequence of windows (instances of Observable).

  • Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    public func withLatestFrom<Source, ResultType>(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Observable<ResultType> where Source : ObservableConvertibleType

    Parameters

    second

    Second observable source.

    resultSelector

    Function to invoke for each element from the self combined with the latest element from the second source, if any.

    Return Value

    An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.

  • withLatestFrom(_:) Extension method

    Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emits an element.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    public func withLatestFrom<Source>(_ second: Source) -> Observable<Source.Element> where Source : ObservableConvertibleType

    Parameters

    second

    Second observable source.

    Return Value

    An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.

  • Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the seqeunce will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    public func withUnretained<Object: AnyObject, Out>(
        _ obj: Object,
        resultSelector: @escaping (Object, Element) -> Out
    ) -> Observable<Out>

    Parameters

    obj

    The object to provide an unretained reference on.

    resultSelector

    A function to combine the unretained referenced on obj and the value of the observable sequence.

    Return Value

    An observable sequence that contains the result of resultSelector being called with an unretained reference on obj and the values of the original sequence.

  • withUnretained(_:) Extension method

    Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the seqeunce will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    public func withUnretained<Object>(_ obj: Object) -> Observable<(Object, Element)> where Object : AnyObject

    Parameters

    obj

    The object to provide an unretained reference on.

    Return Value

    An observable sequence of tuples that contains both an unretained reference on obj and the values of the original sequence.

  • zip(_:resultSelector:) Extension method

    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>
        where Collection.Element: ObservableType

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:) Extension method

    Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>
        where Collection.Element: ObservableType, Collection.Element.Element == Element

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:resultSelector:) Extension method

    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType>
        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:resultSelector:) Extension method

    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:_:resultSelector:) Extension method

    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • asSingle() Extension method

    The asSingle operator throws a RxError.noElements or RxError.moreThanOneElement if the source Observable does not emit exactly one element before successfully completing.

    Declaration

    Swift

    public func asSingle() -> Single<Element>

    Return Value

    An observable sequence that emits a single element when the source Observable has completed, or throws an exception if more (or none) of them are emitted.

  • first() Extension method

    The first operator emits only the very first item emitted by this Observable, or nil if this Observable completes without emitting anything.

    Declaration

    Swift

    public func first() -> Single<Element?>

    Return Value

    An observable sequence that emits a single element or nil if the source observable sequence completes without emitting any items.

  • asMaybe() Extension method

    The asMaybe operator throws a RxError.moreThanOneElement if the source Observable does not emit at most one element before successfully completing.

    Declaration

    Swift

    public func asMaybe() -> Maybe<Element>

    Return Value

    An observable sequence that emits a single element, completes when the source Observable has completed, or throws an exception if more of them are emitted.

Available where Element == Any

  • combineLatest(_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType>
        (_ source1: O1, _ source2: O2)
            -> Observable<(O1.Element, O2.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3)
            -> Observable<(O1.Element, O2.Element, O3.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)
            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)
            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)
            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)
            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)
            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Available where Element == Data

  • decode(type:decoder:) Extension method

    Attempt to decode the emitted Data using a provided decoder.

    Note

    If using a custom decoder, it must conform to the DataDecoder protocol.

    Declaration

    Swift

    func decode<Item: Decodable,
                Decoder: DataDecoder>(type: Item.Type,
                                      decoder: Decoder) -> Observable<Item>

    Parameters

    type

    A Decodable-conforming type to attempt to decode to

    decoder

    A capable decoder, e.g. JSONDecoder or PropertyListDecoder

    Return Value

    An Observable of the decoded type

Available where Element: EventConvertible

Available where Element: Equatable

  • distinctUntilChanged() Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to equality operator.

    Declaration

    Swift

    public func distinctUntilChanged()
        -> Observable<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.

Available where Element: ObservableConvertibleType

  • merge() Extension method

    Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.

    Declaration

    Swift

    public func merge() -> Observable<Element.Element>

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(maxConcurrent:) Extension method

    Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.

    Declaration

    Swift

    public func merge(maxConcurrent: Int)
        -> Observable<Element.Element>

    Parameters

    maxConcurrent

    Maximum number of inner observable sequences being subscribed to concurrently.

    Return Value

    The observable sequence that merges the elements of the inner sequences.

  • concat() Extension method

    Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.

    Declaration

    Swift

    public func concat() -> Observable<Element.Element>

    Return Value

    An observable sequence that contains the elements of each observed inner sequence, in sequential order.

Available where Element: RxAbstractInteger

  • Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages.

    Declaration

    Swift

    public static func range(start: Element, count: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    start

    The value of the first integer in the sequence.

    count

    The number of sequential integers to generate.

    scheduler

    Scheduler to run the generator loop on.

    Return Value

    An observable sequence that contains a range of sequential integral numbers.

Available where Element: ObservableConvertibleType

  • switchLatest() Extension method

    Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

    Each time a new inner observable sequence is received, unsubscribe from the previous inner observable sequence.

    Declaration

    Swift

    public func switchLatest() -> Observable<Element.Element>

    Return Value

    The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.

Available where Element: RxAbstractInteger

  • interval(_:scheduler:) Extension method

    Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.

    Declaration

    Swift

    public static func interval(_ period: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    period

    Period for producing the values in the resulting sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence that produces a value after each period.

  • timer(_:period:scheduler:) Extension method

    Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.

    Declaration

    Swift

    public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval? = nil, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time at which to produce the first value.

    period

    Period to produce subsequent values.

    scheduler

    Scheduler to run timers on.

    Return Value

    An observable sequence that produces a value after due time has elapsed and then each period.

Available where Element == Any

  • zip(_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType>
        (_ source1: O1, _ source2: O2)
        -> Observable<(O1.Element, O2.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3)
        -> Observable<(O1.Element, O2.Element, O3.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Available where Element == Never

  • asCompletable() Extension method

    Declaration

    Swift

    public func asCompletable()
        -> Completable

    Return Value

    An observable sequence that completes.