Skip to content

Combining Operator

.startWith

StartWith prefixes an observable sequence with the given initial value where the value must be of the same type as the observable element.

Which will then return:

.merge

Merge combines multiple observable into a single observable.

You will create two subject which will take in only Int value.

Then you will merge them together.

This will result in:

.combineLatest

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

Here you will be combine both firstSubject and secondSubject forming only one sentence.

Which will then result in:

.reduce

Reduce allows you to applies an accumulator function over an observable sequence and return the result of the aggregation as a single element. Here, you will be using plus (+) and it will add up all the numbers and return the value.

Which will then result in:

Published inRxSwift

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © DaddyCoding 2020.