PrimitiveSequenceType
public protocol PrimitiveSequenceType
Observable sequences containing 0 or 1 element
-
Additional constraints
Declaration
Swift
associatedtype TraitType
-
Sequence element type
Declaration
Swift
associatedtype ElementType
-
Declaration
Swift
var primitiveSequence: PrimitiveSequence<TraitType, ElementType> { get }
Return Value
Observable sequence that represents
self
.
-
andThen(_:)
Extension methodConcatenates the second observable sequence to
self
upon successful termination ofself
.Seealso
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 methodConcatenates the second observable sequence to
self
upon successful termination ofself
.Seealso
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 methodConcatenates the second observable sequence to
self
upon successful termination ofself
.Seealso
Declaration
Swift
public 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 methodConcatenates the second observable sequence to
self
upon successful termination ofself
.Seealso
Declaration
Swift
public func andThen<E>(_ second: Observable<E>) -> Observable<E>
Parameters
second
Second observable sequence.
Return Value
An observable sequence that contains the elements of
self
, followed by those of the second sequence.
-
CompletableObserver
Extension methodUndocumented
Declaration
Swift
public typealias CompletableObserver = (CompletableEvent) -> Void
-
create(subscribe:)
Extension methodCreates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping CompletableObserver) -> Disposable) -> PrimitiveSequence<TraitType, ElementType>
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 methodSubscribes
observer
to receive events for this sequence.Declaration
Swift
public 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(onCompleted:onError:)
Extension methodSubscribes a completion handler and an error handler for this sequence.
Declaration
Swift
public func subscribe(onCompleted: (() -> Void)? = nil, onError: ((Swift.Error) -> 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.
Return Value
Subscription object used to unsubscribe from the observable sequence.
-
error(_:)
Extension methodReturns an observable sequence that terminates with an
error
.Seealso
Declaration
Swift
public static func error(_ error: Swift.Error) -> Completable
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
Declaration
Swift
public static func never() -> Completable
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
Completed
message.Seealso
Declaration
Swift
public static func empty() -> Completable
Return Value
An observable sequence with no elements.
-
do(onError:onCompleted:onSubscribe:onSubscribed:onDispose:)
Extension methodInvokes 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, onCompleted: (() 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.
onCompleted
Action to invoke upon 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 methodConcatenates the second observable sequence to
self
upon successful termination ofself
.Seealso
Declaration
Swift
public 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 methodConcatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
Seealso
Declaration
Swift
public static func concat<S: Sequence>(_ sequence: S) -> Completable where S.Iterator.Element == Completable
Return Value
An observable sequence that contains the elements of each given sequence, in sequential order.
-
concat(_:)
Extension methodConcatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
Seealso
Declaration
Swift
public static func concat<C: Collection>(_ collection: C) -> Completable where C.Iterator.Element == Completable
Return Value
An observable sequence that contains the elements of each given sequence, in sequential order.
-
concat(_:)
Extension methodConcatenates 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...) -> Completable
Return Value
An observable sequence that contains the elements of each given sequence, in sequential order.
-
merge(_:)
Extension methodMerges elements from all observable sequences from collection into a single observable sequence.
Seealso
Declaration
Swift
public static func merge<C: Collection>(_ sources: C) -> Completable where C.Iterator.Element == Completable
Parameters
sources
Collection of observable sequences to merge.
Return Value
The observable sequence that merges the elements of the observable sequences.
-
merge(_:)
Extension methodMerges elements from all observable sequences from array into a single observable sequence.
Seealso
Declaration
Swift
public static func merge(_ sources: [Completable]) -> Completable
Parameters
sources
Array of observable sequences to merge.
Return Value
The observable sequence that merges the elements of the observable sequences.
-
merge(_:)
Extension methodMerges elements from all observable sequences into a single observable sequence.
Seealso
Declaration
Swift
public static func merge(_ sources: Completable...) -> Completable
Parameters
sources
Collection of observable sequences to merge.
Return Value
The observable sequence that merges the elements of the observable sequences.
-
MaybeObserver
Extension methodUndocumented
Declaration
Swift
public typealias MaybeObserver = (MaybeEvent<ElementType>) -> Void
-
create(subscribe:)
Extension methodCreates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping MaybeObserver) -> Disposable) -> PrimitiveSequence<TraitType, ElementType>
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 methodSubscribes
observer
to receive events for this sequence.Declaration
Swift
public func subscribe(_ observer: @escaping (MaybeEvent<ElementType>) -> Void) -> Disposable
Return Value
Subscription for
observer
that can be used to cancel production of sequence elements and free resources. -
subscribe(onSuccess:onError:onCompleted:)
Extension methodSubscribes a success handler, an error handler, and a completion handler for this sequence.
Declaration
Swift
public func subscribe(onSuccess: ((ElementType) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> 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.
Return Value
Subscription object used to unsubscribe from the observable sequence.
-
just(_:)
Extension methodReturns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: ElementType) -> Maybe<ElementType>
Parameters
element
Single element in the resulting observable sequence.
Return Value
An observable sequence containing the single specified element.
-
just(_:scheduler:)
Extension methodReturns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: ElementType, scheduler: ImmediateSchedulerType) -> Maybe<ElementType>
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 methodReturns an observable sequence that terminates with an
error
.Seealso
Declaration
Swift
public static func error(_ error: Swift.Error) -> Maybe<ElementType>
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
Declaration
Swift
public static func never() -> Maybe<ElementType>
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
Completed
message.Seealso
Declaration
Swift
public static func empty() -> Maybe<ElementType>
Return Value
An observable sequence with no elements.
-
do(onNext:onError:onCompleted:onSubscribe:onSubscribed:onDispose:)
Extension methodInvokes 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: ((ElementType) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Maybe<ElementType>
Parameters
onNext
Action to invoke for each element in the observable sequence.
onError
Action to invoke upon errored termination of the observable sequence.
onCompleted
Action to invoke upon graceful termination of the observable sequence.
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 methodFilters the elements of an observable sequence based on a predicate.
Seealso
Declaration
Swift
public func filter(_ predicate: @escaping (ElementType) throws -> Bool) -> Maybe<ElementType>
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 methodProjects each element of an observable sequence into a new form.
Seealso
Declaration
Swift
public func map<R>(_ transform: @escaping (ElementType) throws -> R) -> Maybe<R>
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.
-
flatMap(_:)
Extension methodProjects 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 flatMap<R>(_ selector: @escaping (ElementType) throws -> Maybe<R>) -> Maybe<R>
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 methodEmits elements from the source observable sequence, or a default element if the source observable sequence is empty.
Declaration
Swift
public func ifEmpty(default: ElementType) -> Single<ElementType>
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 methodReturns the elements of the specified sequence or
switchTo
sequence if the sequence is empty.Declaration
Swift
public func ifEmpty(switchTo other: Maybe<ElementType>) -> Maybe<ElementType>
Parameters
switchTo
Observable sequence being returned when source sequence is empty.
Return Value
Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.
-
ifEmpty(switchTo:)
Extension methodReturns the elements of the specified sequence or
switchTo
sequence if the sequence is empty.Declaration
Swift
public func ifEmpty(switchTo other: Single<ElementType>) -> Single<ElementType>
Parameters
switchTo
Observable sequence being returned when source sequence is empty.
Return Value
Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.
-
catchErrorJustReturn(_:)
Extension methodContinues an observable sequence that is terminated by an error with a single element.
Seealso
Declaration
Swift
public func catchErrorJustReturn(_ element: ElementType) -> PrimitiveSequence<TraitType, ElementType>
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.
-
zip(_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, resultSelector: @escaping (E1, E2) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>) -> PrimitiveSequence<TraitType, (E1, E2)>
Return Value
An observable sequence containing the result of combining elements of the sources using the specified result selector function.
-
zip(_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, resultSelector: @escaping (E1, E2) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>) -> PrimitiveSequence<TraitType, (E1, E2)>
Return Value
An observable sequence containing the result of combining elements of the sources using the specified result selector function.
-
zip(_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, resultSelector: @escaping (E1, E2, E3) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>) -> PrimitiveSequence<TraitType, (E1, E2, E3)>
Return Value
An observable sequence containing the result of combining elements of the sources using the specified result selector function.
-
zip(_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, resultSelector: @escaping (E1, E2, E3) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>) -> PrimitiveSequence<TraitType, (E1, E2, E3)>
Return Value
An observable sequence containing the result of combining elements of the sources using the specified result selector function.
-
zip(_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, _ source8: PrimitiveSequence<TraitType, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, _ source8: PrimitiveSequence<TraitType, E8>) -> PrimitiveSequence<TraitType, (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(_:_:_:_:_:_:_:_:resultSelector:)
Extension methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, _ source8: PrimitiveSequence<TraitType, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<TraitType, E1>, _ source2: PrimitiveSequence<TraitType, E2>, _ source3: PrimitiveSequence<TraitType, E3>, _ source4: PrimitiveSequence<TraitType, E4>, _ source5: PrimitiveSequence<TraitType, E5>, _ source6: PrimitiveSequence<TraitType, E6>, _ source7: PrimitiveSequence<TraitType, E7>, _ source8: PrimitiveSequence<TraitType, E8>) -> PrimitiveSequence<TraitType, (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(_:scheduler:)
Extension methodReturns 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<TraitType, ElementType>
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.
-
SingleObserver
Extension methodUndocumented
Declaration
Swift
public typealias SingleObserver = (SingleEvent<ElementType>) -> Void
-
create(subscribe:)
Extension methodCreates an observable sequence from a specified subscribe method implementation.
Seealso
Declaration
Swift
public static func create(subscribe: @escaping (@escaping SingleObserver) -> Disposable) -> Single<ElementType>
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 methodSubscribes
observer
to receive events for this sequence.Declaration
Swift
public func subscribe(_ observer: @escaping (SingleEvent<ElementType>) -> Void) -> Disposable
Return Value
Subscription for
observer
that can be used to cancel production of sequence elements and free resources. -
subscribe(onSuccess:onError:)
Extension methodSubscribes a success handler, and an error handler for this sequence.
Declaration
Swift
public func subscribe(onSuccess: ((ElementType) -> Void)? = nil, onError: ((Swift.Error) -> 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.
Return Value
Subscription object used to unsubscribe from the observable sequence.
-
just(_:)
Extension methodReturns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: ElementType) -> Single<ElementType>
Parameters
element
Single element in the resulting observable sequence.
Return Value
An observable sequence containing the single specified element.
-
just(_:scheduler:)
Extension methodReturns an observable sequence that contains a single element.
Seealso
Declaration
Swift
public static func just(_ element: ElementType, scheduler: ImmediateSchedulerType) -> Single<ElementType>
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 methodReturns an observable sequence that terminates with an
error
.Seealso
Declaration
Swift
public static func error(_ error: Swift.Error) -> Single<ElementType>
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
Declaration
Swift
public static func never() -> Single<ElementType>
Return Value
An observable sequence whose observers will never get called.
-
do(onSuccess:onError:onSubscribe:onSubscribed:onDispose:)
Extension methodInvokes 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: ((ElementType) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Single<ElementType>
Parameters
onSuccess
Action to invoke for each element in the observable sequence.
onError
Action to invoke upon 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.
-
do(onNext:onError:onSubscribe:onSubscribed:onDispose:)
Extension methodInvokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.
Seealso
Declaration
Swift
@available(*, deprecated, renamed: "do(onSuccess:onError:onSubscribe:onSubscribed:onDispose:﹚") public func `do`(onNext: ((ElementType) throws -> Void)?, onError: ((Swift.Error) throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Single<ElementType>
Parameters
onNext
Action to invoke for each element in the observable sequence.
onError
Action to invoke upon 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 methodFilters the elements of an observable sequence based on a predicate.
Seealso
Declaration
Swift
public func filter(_ predicate: @escaping (ElementType) throws -> Bool) -> Maybe<ElementType>
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 methodProjects each element of an observable sequence into a new form.
Seealso
Declaration
Swift
public func map<R>(_ transform: @escaping (ElementType) throws -> R) -> Single<R>
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.
-
flatMap(_:)
Extension methodProjects 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 flatMap<R>(_ selector: @escaping (ElementType) throws -> Single<R>) -> Single<R>
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 methodProjects 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 flatMapMaybe<R>(_ selector: @escaping (ElementType) throws -> Maybe<R>) -> Maybe<R>
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 methodProjects 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 (ElementType) 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(_:_:)
Extension methodMerges 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<C: Collection, R>(_ collection: C, _ resultSelector: @escaping ([ElementType]) throws -> R) -> PrimitiveSequence<TraitType, R> where C.Iterator.Element == PrimitiveSequence<TraitType, ElementType>
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 methodMerges 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<C>(_ collection: C) -> PrimitiveSequence<TraitType, [ElementType]> where C : Collection, C.Element == PrimitiveSequence<SingleTrait, Self.ElementType>
Return Value
An observable sequence containing the result of combining elements of the sources.
-
catchErrorJustReturn(_:)
Extension methodContinues an observable sequence that is terminated by an error with a single element.
Seealso
Declaration
Swift
public func catchErrorJustReturn(_ element: ElementType) -> PrimitiveSequence<TraitType, ElementType>
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 methodConverts
self
toMaybe
trait.Declaration
Swift
public func asMaybe() -> Maybe<ElementType>
Return Value
Maybe trait that represents
self
. -
asCompletable()
Extension methodConverts
self
toCompletable
trait.Declaration
Swift
public func asCompletable() -> Completable
Return Value
Completable trait that represents
self
.