PrimitiveSequenceType
public protocol PrimitiveSequenceType
Observable sequences containing 0 or 1 element
-
Additional constraints
Declaration
Swift
associatedtype Trait -
Sequence element type
Declaration
Swift
associatedtype Element -
Declaration
Swift
var primitiveSequence: PrimitiveSequence<Trait, Element> { get }Return Value
Observable sequence that represents
self.
-
andThen(_:Extension method) Concatenates the second observable sequence to
selfupon successful termination ofself.Seealso
Parameters
secondSecond 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
selfupon successful termination ofself.Seealso
Parameters
secondSecond 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
selfupon successful termination ofself.Seealso
Declaration
Swift
public func andThen(_ second: Completable) -> CompletableParameters
secondSecond 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
selfupon successful termination ofself.Seealso
Declaration
Swift
public func andThen<Element>(_ second: Observable<Element>) -> Observable<Element>Parameters
secondSecond observable sequence.
Return Value
An observable sequence that contains the elements of
self, followed by those of the second sequence.
-
CompletableObserverExtension methodUndocumented
Declaration
Swift
public typealias CompletableObserver = (CompletableEvent) -> Void -
create(subscribe:Extension method) Creates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping CompletableObserver) -> Disposable) -> PrimitiveSequence<Trait, Element>Parameters
subscribeImplementation of the resulting observable sequence’s
subscribemethod.Return Value
The observable sequence with the specified implementation for the
subscribemethod. -
subscribe(_:Extension method) Subscribes
observerto receive events for this sequence.Declaration
Swift
public func subscribe(_ observer: @escaping (CompletableEvent) -> Void) -> DisposableReturn Value
Subscription for
observerthat can be used to cancel production of sequence elements and free resources. -
subscribe(with:Extension methodonCompleted: onError: onDisposed: ) 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
objectcan’t be retained, none of the other closures will be invoked.Declaration
Swift
public func subscribe<Object: AnyObject>( with object: Object, onCompleted: ((Object) -> Void)? = nil, onError: ((Object, Swift.Error) -> Void)? = nil, onDisposed: ((Object) -> Void)? = nil ) -> DisposableParameters
objectThe object to provide an unretained reference on.
onCompletedAction to invoke upon graceful termination of the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
onDisposedAction 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:Extension methodonError: onDisposed: ) Subscribes a completion handler and an error handler for this sequence.
Declaration
Swift
public func subscribe(onCompleted: (() -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> DisposableParameters
onCompletedAction to invoke upon graceful termination of the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
onDisposedAction 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
Declaration
Swift
public static func error(_ error: Swift.Error) -> CompletableReturn Value
The observable sequence that terminates with specified error.
-
never()Extension methodReturns a non-terminating observable sequence, which can be used to denote an infinite duration.
Seealso
Declaration
Swift
public static func never() -> CompletableReturn Value
An observable sequence whose observers will never get called.
-
empty()Extension methodReturns an empty observable sequence, using the specified scheduler to send out the single
Completedmessage.Seealso
Declaration
Swift
public static func empty() -> CompletableReturn Value
An observable sequence with no elements.
-
do(onError:Extension methodafterError: onCompleted: afterCompleted: onSubscribe: onSubscribed: onDispose: ) Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.
Seealso
Declaration
Swift
public 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) -> CompletableParameters
onNextAction to invoke for each element in the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
afterErrorAction to invoke after errored termination of the observable sequence.
onCompletedAction to invoke upon graceful termination of the observable sequence.
afterCompletedAction to invoke after graceful termination of the observable sequence.
onSubscribeAction to invoke before subscribing to source observable sequence.
onSubscribedAction to invoke after subscribing to source observable sequence.
onDisposeAction 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
selfupon successful termination ofself.Seealso
Declaration
Swift
public func concat(_ second: Completable) -> CompletableParameters
secondSecond 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
Declaration
Swift
public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Completable where Sequence.Element == CompletableReturn 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
Declaration
Swift
public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Completable where Collection.Element == CompletableReturn 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
Declaration
Swift
public static func concat(_ sources: Completable...) -> CompletableReturn 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.ioNote
For
Completable,zipis an alias formerge.Declaration
Swift
public static func zip<Collection: Swift.Collection>(_ sources: Collection) -> Completable where Collection.Element == CompletableParameters
sourcesCollection 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.ioNote
For
Completable,zipis an alias formerge.Declaration
Swift
public static func zip(_ sources: [Completable]) -> CompletableParameters
sourcesArray 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.ioNote
For
Completable,zipis an alias formerge.Declaration
Swift
public static func zip(_ sources: Completable...) -> CompletableParameters
sourcesCollection of observable sequences to merge.
Return Value
The observable sequence that merges the elements of the observable sequences.
-
MaybeObserverExtension methodUndocumented
Declaration
Swift
public typealias MaybeObserver = (MaybeEvent<Element>) -> Void -
create(subscribe:Extension method) Creates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping MaybeObserver) -> Disposable) -> PrimitiveSequence<Trait, Element>Parameters
subscribeImplementation of the resulting observable sequence’s
subscribemethod.Return Value
The observable sequence with the specified implementation for the
subscribemethod. -
subscribe(_:Extension method) Subscribes
observerto receive events for this sequence.Declaration
Swift
public func subscribe(_ observer: @escaping (MaybeEvent<Element>) -> Void) -> DisposableReturn Value
Subscription for
observerthat can be used to cancel production of sequence elements and free resources. -
subscribe(with:Extension methodonSuccess: onError: onCompleted: onDisposed: ) 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
objectcan’t be retained, none of the other closures will be invoked.Declaration
Swift
public 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 ) -> DisposableParameters
objectThe object to provide an unretained reference on.
onSuccessAction to invoke for each element in the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
onCompletedAction to invoke upon graceful termination of the observable sequence.
onDisposedAction 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:Extension methodonError: onCompleted: onDisposed: ) Subscribes a success handler, an error handler, and a completion handler for this sequence.
Declaration
Swift
public func subscribe(onSuccess: ((Element) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> DisposableParameters
onSuccessAction to invoke for each element in the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
onCompletedAction to invoke upon graceful termination of the observable sequence.
onDisposedAction 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
Parameters
elementSingle element in the resulting observable sequence.
Return Value
An observable sequence containing the single specified element.
-
just(_:Extension methodscheduler: ) Returns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Maybe<Element>Parameters
elementSingle element in the resulting observable sequence.
schedulerScheduler 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
Return Value
The observable sequence that terminates with specified error.
-
never()Extension methodReturns a non-terminating observable sequence, which can be used to denote an infinite duration.
Seealso
Return Value
An observable sequence whose observers will never get called.
-
empty()Extension methodReturns an empty observable sequence, using the specified scheduler to send out the single
Completedmessage.Seealso
Return Value
An observable sequence with no elements.
-
do(onNext:Extension methodafterNext: onError: afterError: onCompleted: afterCompleted: onSubscribe: onSubscribed: onDispose: ) Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.
Seealso
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) -> Maybe<Element>Parameters
onNextAction to invoke for each element in the observable sequence.
afterNextAction to invoke for each element after the observable has passed an onNext event along to its downstream.
onErrorAction to invoke upon errored termination of the observable sequence.
afterErrorAction to invoke after errored termination of the observable sequence.
onCompletedAction to invoke upon graceful termination of the observable sequence.
afterCompletedAction to invoke after graceful termination of the observable sequence.
onSubscribeAction to invoke before subscribing to source observable sequence.
onSubscribedAction to invoke after subscribing to source observable sequence.
onDisposeAction 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
Declaration
Parameters
predicateA 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
Declaration
Parameters
transformA 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
Parameters
transformA 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
Declaration
Parameters
selectorA 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.
Parameters
defaultDefault 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
othersequence if the sequence is empty.Parameters
otherObservable 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
othersequence if the sequence is empty.Parameters
otherObservable 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
Declaration
Swift
public func catchAndReturn(_ element: Element) -> PrimitiveSequence<Trait, Element>Parameters
elementLast element in an observable sequence in case error occurs.
Return Value
An observable sequence containing the source sequence’s elements, followed by the
elementin case an error occurred. -
catchErrorJustReturn(_:Extension method) Continues an observable sequence that is terminated by an error with a single element.
Seealso
Declaration
Swift
@available(*, deprecated, renamed: "catchAndReturn(_:﹚") public func catchErrorJustReturn(_ element: Element) -> PrimitiveSequence<Trait, Element>Parameters
elementLast element in an observable sequence in case error occurs.
Return Value
An observable sequence containing the source sequence’s elements, followed by the
elementin case an error occurred.
-
create(detached:Extension methodpriority: work: ) Creates a
Singlefrom the result of an asynchronous operationSeealso
Declaration
Swift
@_disfavoredOverload static func create( detached: Bool = false, priority: TaskPriority? = nil, work: @Sendable @escaping () async throws -> Element ) -> PrimitiveSequence<Trait, Element>Parameters
workAn
asyncclosure expected to return an element of typeElementReturn Value
A
Singleof theasyncclosure’s element type -
valueExtension method, asynchronous
-
valueExtension method, asynchronousAllows awaiting the success or failure of this
Maybeasynchronously via Swift’s concurrency features (async/await)If the
Maybecompletes without emitting a value, it would return anilvalue 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 }
-
valueExtension method, asynchronousAllows awaiting the success or failure of this
Completableasynchronously via Swift’s concurrency features (async/await)Upon completion, a
Voidwill be returnedA 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 }
-
zip(_:Extension method_: resultSelector: ) 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
Declaration
Swift
public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element) -> PrimitiveSequence<Trait, Element>Parameters
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: resultSelector: ) 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
Declaration
Swift
public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element) -> PrimitiveSequence<Trait, Element>Parameters
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
zip(_:Extension method_: _: _: _: _: _: _: resultSelector: ) 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
Declaration
Swift
public 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
resultSelectorFunction 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 of tuples whenever all of the observable sequences have produced an element at a corresponding index.
Seealso
Declaration
Swift
public 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.
-
timer(_:Extension methodscheduler: ) 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
Declaration
Swift
public static func timer(_ dueTime: RxTimeInterval, scheduler: SchedulerType) -> PrimitiveSequence<Trait, Element>Parameters
dueTimeRelative time at which to produce the first value.
schedulerScheduler to run timers on.
Return Value
An observable sequence that produces a value after due time has elapsed and then each period.
-
SingleObserverExtension methodUndocumented
Declaration
Swift
public typealias SingleObserver = (SingleEvent<Element>) -> Void -
create(subscribe:Extension method) Creates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping SingleObserver) -> Disposable) -> Single<Element>Parameters
subscribeImplementation of the resulting observable sequence’s
subscribemethod.Return Value
The observable sequence with the specified implementation for the
subscribemethod. -
subscribe(_:Extension method) Subscribes
observerto receive events for this sequence.Declaration
Swift
public func subscribe(_ observer: @escaping (SingleEvent<Element>) -> Void) -> DisposableReturn Value
Subscription for
observerthat can be used to cancel production of sequence elements and free resources. -
subscribe(onSuccess:Extension methodonError: onDisposed: ) Subscribes a success handler, and an error handler for this sequence.
Declaration
Swift
@available(*, deprecated, renamed: "subscribe(onSuccess:onFailure:onDisposed:﹚") public func subscribe(onSuccess: ((Element) -> Void)? = nil, onError: @escaping ((Swift.Error) -> Void), onDisposed: (() -> Void)? = nil) -> DisposableParameters
onSuccessAction to invoke for each element in the observable sequence.
onErrorAction to invoke upon errored termination of the observable sequence.
onDisposedAction 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:Extension methodonSuccess: onFailure: onDisposed: ) 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
objectcan’t be retained, none of the other closures will be invoked.Declaration
Swift
public func subscribe<Object: AnyObject>( with object: Object, onSuccess: ((Object, Element) -> Void)? = nil, onFailure: ((Object, Swift.Error) -> Void)? = nil, onDisposed: ((Object) -> Void)? = nil ) -> DisposableParameters
objectThe object to provide an unretained reference on.
onSuccessAction to invoke for each element in the observable sequence.
onFailureAction to invoke upon errored termination of the observable sequence.
onDisposedAction 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:Extension methodonFailure: onDisposed: ) Subscribes a success handler, and an error handler for this sequence.
Declaration
Swift
public func subscribe(onSuccess: ((Element) -> Void)? = nil, onFailure: ((Swift.Error) -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> DisposableParameters
onSuccessAction to invoke for each element in the observable sequence.
onFailureAction to invoke upon errored termination of the observable sequence.
onDisposedAction 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
Parameters
elementSingle element in the resulting observable sequence.
Return Value
An observable sequence containing the single specified element.
-
just(_:Extension methodscheduler: ) Returns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Single<Element>Parameters
elementSingle element in the resulting observable sequence.
schedulerScheduler 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
Return Value
The observable sequence that terminates with specified error.
-
never()Extension methodReturns a non-terminating observable sequence, which can be used to denote an infinite duration.
Seealso
Return Value
An observable sequence whose observers will never get called.
-
Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.
Seealso
Declaration
Swift
public 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
onSuccessAction to invoke for each element in the observable sequence.
afterSuccessAction to invoke for each element after the observable has passed an onNext event along to its downstream.
onErrorAction to invoke upon errored termination of the observable sequence.
afterErrorAction to invoke after errored termination of the observable sequence.
onSubscribeAction to invoke before subscribing to source observable sequence.
onSubscribedAction to invoke after subscribing to source observable sequence.
onDisposeAction 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
Declaration
Parameters
predicateA 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
Declaration
Parameters
transformA 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
Parameters
transformA 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
Declaration
Parameters
selectorA 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
Declaration
Parameters
selectorA 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
Declaration
Swift
public func flatMapCompletable(_ selector: @escaping (Element) throws -> Completable) -> CompletableParameters
selectorA 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(_:Extension methodresultSelector: ) 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, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> PrimitiveSequence<Trait, Result> where Collection : Collection, Collection.Element == PrimitiveSequence<SingleTrait, Self.Element>Parameters
resultSelectorFunction 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
public 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
Declaration
Swift
public func catchAndReturn(_ element: Element) -> PrimitiveSequence<Trait, Element>Parameters
elementLast element in an observable sequence in case error occurs.
Return Value
An observable sequence containing the source sequence’s elements, followed by the
elementin case an error occurred. -
catchErrorJustReturn(_:Extension method) Continues an observable sequence that is terminated by an error with a single element.
Seealso
Declaration
Swift
@available(*, deprecated, renamed: "catchAndReturn(_:﹚") public func catchErrorJustReturn(_ element: Element) -> PrimitiveSequence<Trait, Element>Parameters
elementLast element in an observable sequence in case error occurs.
Return Value
An observable sequence containing the source sequence’s elements, followed by the
elementin case an error occurred. -
asMaybe()Extension method -
asCompletable()Extension methodConverts
selftoCompletabletrait, ignoring its emitted value if one exists.Declaration
Swift
public func asCompletable() -> CompletableReturn Value
Completable trait that represents
self.
View on GitHub
PrimitiveSequenceType Protocol Reference