Back to Rxswift

PrimitiveSequenceType

docs/Protocols/PrimitiveSequenceType.html

6.10.277.9 KB
Original Source

PrimitiveSequenceType

public protocol PrimitiveSequenceType

Observable sequences containing 0 or 1 element

`

                Trait
                `

Additional constraints

Declaration

Swift

associatedtype Trait

`

                Element
                `

Sequence element type

Declaration

Swift

associatedtype Element

`

                primitiveSequence
                `

Declaration

Swift

var primitiveSequence: PrimitiveSequence<Trait, Element> { get }

Return Value

Observable sequence that represents self.

Available where Trait == CompletableTrait, Element == Never

`

                andThen(_:)
                ` Extension method 

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

Seealso

concat operator on reactivex.io

Declaration

Swift

func andThen<Element>(_ second: Single<Element>) -> Single<Element>

Parameters

| second |

Second observable sequence.

|

Return Value

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

`

                andThen(_:)
                ` Extension method 

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

Seealso

concat operator on reactivex.io

Declaration

Swift

func andThen<Element>(_ second: Maybe<Element>) -> Maybe<Element>

Parameters

| second |

Second observable sequence.

|

Return Value

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

`

                andThen(_:)
                ` Extension method 

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

Seealso

concat operator on reactivex.io

Declaration

Swift

func andThen(_ second: Completable) -> Completable

Parameters

| second |

Second observable sequence.

|

Return Value

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

`

                andThen(_:)
                ` Extension method 

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

Seealso

concat operator on reactivex.io

Declaration

Swift

func andThen<Element>(_ second: Observable<Element>) -> Observable<Element>

Parameters

| second |

Second observable sequence.

|

Return Value

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

Available where Trait == CompletableTrait, Element == Swift.Never

`

                CompletableObserver
                ` Extension method 

Undocumented

Declaration

Swift

typealias CompletableObserver = (CompletableEvent) -> Void

`

                create(subscribe:)
                ` Extension method 

Creates an observable sequence from a specified subscribe method implementation.

Seealso

create operator on reactivex.io

Declaration

Swift

static func create(subscribe: @escaping (@escaping CompletableObserver) -> Disposable) -> PrimitiveSequence<Trait, 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.

`

                subscribe(_:)
                ` Extension method 

Subscribes observer to receive events for this sequence.

Declaration

Swift

func subscribe(_ observer: @escaping (CompletableEvent) -> Void) -> Disposable

Return Value

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

`

                subscribe(with:onCompleted:onError:onDisposed:)
                ` Extension method 

Subscribes a completion handler and an error handler for this 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

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

Parameters

| object |

The object to provide an unretained reference on.

| | onCompleted |

Action to invoke upon graceful termination of the observable sequence.

| | onError |

Action to invoke upon errored 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.

`

                subscribe(onCompleted:onError:onDisposed:)
                ` Extension method 

Subscribes a completion handler and an error handler for this sequence.

Declaration

Swift

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

Parameters

| onCompleted |

Action to invoke upon graceful termination of the observable sequence.

| | onError |

Action to invoke upon errored 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.

`

                error(_:)
                ` Extension method 

Returns an observable sequence that terminates with an error.

Seealso

throw operator on reactivex.io

Declaration

Swift

static func error(_ error: Swift.Error) -> Completable

Return Value

The observable sequence that terminates with specified error.

`

                never()
                ` Extension method 

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

Seealso

never operator on reactivex.io

Declaration

Swift

static func never() -> Completable

Return Value

An observable sequence whose observers will never get called.

`

                empty()
                ` Extension method 

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

Seealso

empty operator on reactivex.io

Declaration

Swift

static func empty() -> Completable

Return Value

An observable sequence with no elements.

`

                do(onError:afterError:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)
                ` Extension method 

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

Seealso

do operator on reactivex.io

Declaration

Swift

func `do`(
    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
)
    -> Completable

Parameters

| onNext |

Action to invoke for each element in the observable sequence.

| | 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.

`

                concat(_:)
                ` Extension method 

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

Seealso

concat operator on reactivex.io

Declaration

Swift

func concat(_ second: Completable) -> Completable

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.

Seealso

concat operator on reactivex.io

Declaration

Swift

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

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 sequence, as long as the previous observable sequence terminated successfully.

Seealso

concat operator on reactivex.io

Declaration

Swift

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

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 sequence, as long as the previous observable sequence terminated successfully.

Seealso

concat operator on reactivex.io

Declaration

Swift

static func concat(_ sources: Completable...) -> Completable

Return Value

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

`

                zip(_:)
                ` Extension method 

Merges the completion of all Completables from a collection into a single Completable.

Seealso

merge operator on reactivex.io

Note

For Completable, zip is an alias for merge.

Declaration

Swift

static func zip<Collection: Swift.Collection>(_ sources: Collection) -> Completable
    where Collection.Element == Completable

Parameters

| sources |

Collection of Completables to merge.

|

Return Value

A Completable that merges the completion of all Completables.

`

                zip(_:)
                ` Extension method 

Merges the completion of all Completables from an array into a single Completable.

Seealso

merge operator on reactivex.io

Note

For Completable, zip is an alias for merge.

Declaration

Swift

static func zip(_ sources: [Completable]) -> Completable

Parameters

| sources |

Array of observable sequences to merge.

|

Return Value

A Completable that merges the completion of all Completables.

`

                zip(_:)
                ` Extension method 

Merges the completion of all Completables into a single Completable.

Seealso

merge operator on reactivex.io

Note

For Completable, zip is an alias for merge.

Declaration

Swift

static func zip(_ sources: Completable...) -> Completable

Parameters

| sources |

Collection of observable sequences to merge.

|

Return Value

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

Available where Trait == MaybeTrait

`

                MaybeObserver
                ` Extension method 

Undocumented

Declaration

Swift

typealias MaybeObserver = (MaybeEvent<Element>) -> Void

`

                create(subscribe:)
                ` Extension method 

Creates an observable sequence from a specified subscribe method implementation.

Seealso

create operator on reactivex.io

Declaration

Swift

static func create(subscribe: @escaping (@escaping MaybeObserver) -> Disposable) -> PrimitiveSequence<Trait, 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.

`

                subscribe(_:)
                ` Extension method 

Subscribes observer to receive events for this sequence.

Declaration

Swift

func subscribe(_ observer: @escaping (MaybeEvent<Element>) -> Void) -> Disposable

Return Value

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

`

                subscribe(with:onSuccess:onError:onCompleted:onDisposed:)
                ` Extension method 

Subscribes a success handler, an error handler, and a completion handler for this 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

func subscribe<Object: AnyObject>(
    with object: Object,
    onSuccess: ((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.

| | onSuccess |

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.

`

                subscribe(onSuccess:onError:onCompleted:onDisposed:)
                ` Extension method 

Subscribes a success handler, an error handler, and a completion handler for this sequence.

Declaration

Swift

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

Parameters

| onSuccess |

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.

`

                just(_:)
                ` Extension method 

Returns an observable sequence that contains a single element.

Seealso

just operator on reactivex.io

Declaration

Swift

static func just(_ element: Element) -> Maybe<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.

Seealso

just operator on reactivex.io

Declaration

Swift

static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Maybe<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.

`

                error(_:)
                ` Extension method 

Returns an observable sequence that terminates with an error.

Seealso

throw operator on reactivex.io

Declaration

Swift

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

Return Value

The observable sequence that terminates with specified error.

`

                never()
                ` Extension method 

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

Seealso

never operator on reactivex.io

Declaration

Swift

static func never() -> Maybe<Element>

Return Value

An observable sequence whose observers will never get called.

`

                empty()
                ` Extension method 

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

Seealso

empty operator on reactivex.io

Declaration

Swift

static func empty() -> Maybe<Element>

Return Value

An observable sequence with no elements.

`

                do(onNext:afterNext:onError:afterError:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)
                ` Extension method 

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

Seealso

do operator on reactivex.io

Declaration

Swift

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
)
    -> Maybe<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.

`

                filter(_:)
                ` Extension method 

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

Seealso

filter operator on reactivex.io

Declaration

Swift

func filter(_ predicate: @escaping (Element) throws -> Bool)
    -> Maybe<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.

`

                map(_:)
                ` Extension method 

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

Seealso

map operator on reactivex.io

Declaration

Swift

func map<Result>(_ transform: @escaping (Element) throws -> Result)
    -> Maybe<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.

`

                compactMap(_:)
                ` Extension method 

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

Declaration

Swift

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

Parameters

| transform |

A transform function to apply to each source element.

|

Return Value

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

`

                flatMap(_:)
                ` Extension method 

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

Seealso

flatMap operator on reactivex.io

Declaration

Swift

func flatMap<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)
    -> Maybe<Result>

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.

`

                ifEmpty(default:)
                ` Extension method 

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

Seealso

DefaultIfEmpty operator on reactivex.io

Declaration

Swift

func ifEmpty(default: Element) -> Single<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

`

                ifEmpty(switchTo:)
                ` Extension method 

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

Seealso

DefaultIfEmpty operator on reactivex.io

Declaration

Swift

func ifEmpty(switchTo other: Maybe<Element>) -> Maybe<Element>

Parameters

| other |

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.

`

                ifEmpty(switchTo:)
                ` Extension method 

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

Seealso

DefaultIfEmpty operator on reactivex.io

Declaration

Swift

func ifEmpty(switchTo other: Single<Element>) -> Single<Element>

Parameters

| other |

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.

`

                catchAndReturn(_:)
                ` Extension method 

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

Seealso

catch operator on reactivex.io

Declaration

Swift

func catchAndReturn(_ element: Element)
    -> PrimitiveSequence<Trait, 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.

Seealso

catch operator on reactivex.io

Declaration

Swift

@available(*, deprecated, renamed: "catchAndReturn(_:﹚")
func catchErrorJustReturn(_ element: Element)
    -> PrimitiveSequence<Trait, 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.

Available where Trait == SingleTrait

`

                create(detached:priority:work:)
                ` Extension method 

Creates a Single from the result of an asynchronous operation

Seealso

create operator on reactivex.io

Declaration

Swift

@_disfavoredOverload
static func create(
    detached: Bool = false,
    priority: TaskPriority? = nil,
    work: @Sendable @escaping () async throws -> Element
) -> PrimitiveSequence<Trait, Element>

Parameters

| work |

An async closure expected to return an element of type Element

|

Return Value

A Single of the async closure’s element type

`

                value
                ` Extension method, asynchronous 

Allows awaiting the success or failure of this Single asynchronously via Swift’s concurrency features (async/await)

A sample usage would look like so:

do {
    let value = try await single.value
} catch {
    // Handle error
}

Declaration

Swift

var value: Element { get async throws }

Available where Trait == MaybeTrait

`

                value
                ` Extension method, asynchronous 

Allows awaiting the success or failure of this Maybe asynchronously via Swift’s concurrency features (async/await)

If the Maybe completes without emitting a value, it would return a nil value to indicate so.

A sample usage would look like so:

do {
    let value = try await maybe.value // Element?
} catch {
    // Handle error
}

Declaration

Swift

var value: Element? { get async throws }

Available where Trait == CompletableTrait, Element == Never

`

                value
                ` Extension method, asynchronous 

Allows awaiting the success or failure of this Completable asynchronously via Swift’s concurrency features (async/await)

Upon completion, a Void will be returned

A sample usage would look like so:

do {
    let value = try await completable.value // Void
} catch {
    // Handle error
}

Declaration

Swift

var value: Void { get async throws }

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)
    -> PrimitiveSequence<Trait, (E1, E2)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)
    -> PrimitiveSequence<Trait, (E1, E2)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>)
    -> PrimitiveSequence<Trait, (E1, E2, E3)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>)
    -> PrimitiveSequence<Trait, (E1, E2, E3)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7)>

Return Value

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

Available where Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == SingleTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7, E8)>

Return Value

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

Available where Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)
    -> PrimitiveSequence<Trait, 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.

Available where Element == Any, Trait == MaybeTrait

`

                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.

Seealso

zip operator on reactivex.io

Declaration

Swift

static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>)
    -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7, E8)>

Return Value

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

Available where Element: RxAbstractInteger

`

                timer(_: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.

Seealso

timer operator on reactivex.io

Declaration

Swift

static func timer(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
    -> PrimitiveSequence<Trait, Element>

Parameters

| dueTime |

Relative time at which to produce the first value.

| | 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 Trait == SingleTrait

`

                SingleObserver
                ` Extension method 

Undocumented

Declaration

Swift

typealias SingleObserver = (SingleEvent<Element>) -> Void

`

                create(subscribe:)
                ` Extension method 

Creates an observable sequence from a specified subscribe method implementation.

Seealso

create operator on reactivex.io

Declaration

Swift

static func create(subscribe: @escaping (@escaping SingleObserver) -> Disposable) -> Single<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.

`

                subscribe(_:)
                ` Extension method 

Subscribes observer to receive events for this sequence.

Declaration

Swift

func subscribe(_ observer: @escaping (SingleEvent<Element>) -> Void) -> Disposable

Return Value

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

`

                subscribe(onSuccess:onError:onDisposed:)
                ` Extension method 

Subscribes a success handler, and an error handler for this sequence.

Declaration

Swift

@available(*, deprecated, renamed: "subscribe(onSuccess:onFailure:onDisposed:﹚")
func subscribe(
    onSuccess: ((Element) -> Void)? = nil,
    onError: @escaping ((Swift.Error) -> Void),
    onDisposed: (() -> Void)? = nil
) -> Disposable

Parameters

| onSuccess |

Action to invoke for each element in the observable sequence.

| | onError |

Action to invoke upon errored 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.

`

                subscribe(with:onSuccess:onFailure:onDisposed:)
                ` Extension method 

Subscribes a success handler, and an error handler for this 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

func subscribe<Object: AnyObject>(
    with object: Object,
    onSuccess: ((Object, Element) -> Void)? = nil,
    onFailure: ((Object, Swift.Error) -> Void)? = nil,
    onDisposed: ((Object) -> Void)? = nil
) -> Disposable

Parameters

| object |

The object to provide an unretained reference on.

| | onSuccess |

Action to invoke for each element in the observable sequence.

| | onFailure |

Action to invoke upon errored 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.

`

                subscribe(onSuccess:onFailure:onDisposed:)
                ` Extension method 

Subscribes a success handler, and an error handler for this sequence.

Declaration

Swift

func subscribe(
    onSuccess: ((Element) -> Void)? = nil,
    onFailure: ((Swift.Error) -> Void)? = nil,
    onDisposed: (() -> Void)? = nil
) -> Disposable

Parameters

| onSuccess |

Action to invoke for each element in the observable sequence.

| | onFailure |

Action to invoke upon errored 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.

`

                just(_:)
                ` Extension method 

Returns an observable sequence that contains a single element.

Seealso

just operator on reactivex.io

Declaration

Swift

static func just(_ element: Element) -> Single<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.

Seealso

just operator on reactivex.io

Declaration

Swift

static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Single<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.

`

                error(_:)
                ` Extension method 

Returns an observable sequence that terminates with an error.

Seealso

throw operator on reactivex.io

Declaration

Swift

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

Return Value

The observable sequence that terminates with specified error.

`

                never()
                ` Extension method 

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

Seealso

never operator on reactivex.io

Declaration

Swift

static func never() -> Single<Element>

Return Value

An observable sequence whose observers will never get called.

`

                do(onSuccess:afterSuccess:onError:afterError:onSubscribe:onSubscribed:onDispose:)
                ` Extension method 

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

Seealso

do operator on reactivex.io

Declaration

Swift

func `do`(
    onSuccess: ((Element) throws -> Void)? = nil,
    afterSuccess: ((Element) throws -> Void)? = nil,
    onError: ((Swift.Error) throws -> Void)? = nil,
    afterError: ((Swift.Error) throws -> Void)? = nil,
    onSubscribe: (() -> Void)? = nil,
    onSubscribed: (() -> Void)? = nil,
    onDispose: (() -> Void)? = nil
)
    -> Single<Element>

Parameters

| onSuccess |

Action to invoke for each element in the observable sequence.

| | afterSuccess |

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.

| | 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.

`

                filter(_:)
                ` Extension method 

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

Seealso

filter operator on reactivex.io

Declaration

Swift

func filter(_ predicate: @escaping (Element) throws -> Bool)
    -> Maybe<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.

`

                map(_:)
                ` Extension method 

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

Seealso

map operator on reactivex.io

Declaration

Swift

func map<Result>(_ transform: @escaping (Element) throws -> Result)
    -> Single<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.

`

                compactMap(_:)
                ` Extension method 

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

Declaration

Swift

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

Parameters

| transform |

A transform function to apply to each source element.

|

Return Value

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

`

                flatMap(_:)
                ` Extension method 

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

Seealso

flatMap operator on reactivex.io

Declaration

Swift

func flatMap<Result>(_ selector: @escaping (Element) throws -> Single<Result>)
    -> Single<Result>

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.

`

                flatMapMaybe(_:)
                ` Extension method 

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

Seealso

flatMap operator on reactivex.io

Declaration

Swift

func flatMapMaybe<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)
    -> Maybe<Result>

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.

`

                flatMapCompletable(_:)
                ` Extension method 

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

Seealso

flatMap operator on reactivex.io

Declaration

Swift

func flatMapCompletable(_ selector: @escaping (Element) throws -> Completable)
    -> Completable

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.

`

                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

static func zip<Collection, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> PrimitiveSequence<Trait, Result> where Collection : Collection, Collection.Element == PrimitiveSequence<SingleTrait, Self.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(_:)
                ` Extension method 

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

Declaration

Swift

static func zip<Collection>(_ collection: Collection) -> PrimitiveSequence<Trait, [Element]> where Collection : Collection, Collection.Element == PrimitiveSequence<SingleTrait, Self.Element>

Return Value

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

`

                catchAndReturn(_:)
                ` Extension method 

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

Seealso

catch operator on reactivex.io

Declaration

Swift

func catchAndReturn(_ element: Element)
    -> PrimitiveSequence<Trait, 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.

Seealso

catch operator on reactivex.io

Declaration

Swift

@available(*, deprecated, renamed: "catchAndReturn(_:﹚")
func catchErrorJustReturn(_ element: Element)
    -> PrimitiveSequence<Trait, 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.

`

                asMaybe()
                ` Extension method 

Converts self to Maybe trait.

Declaration

Swift

func asMaybe() -> Maybe<Element>

Return Value

Maybe trait that represents self.

`

                asCompletable()
                ` Extension method 

Converts self to Completable trait, ignoring its emitted value if one exists.

Declaration

Swift

func asCompletable() -> Completable

Return Value

Completable trait that represents self.