Cheatography
https://cheatography.com
RxSwift supported operators
Creating ObservablesasObservable | convert various objects into Observables | create | create an Observable from scratch | deferred | create an Observable for each subscription | from (array) | convert an array into Observable | of | empty | emit no items; terminates normally | error | emit no items; terminates with an error | never | emit no items; does not terminate | interval | emit a sequence of integers spaced by a given time interval | just | emit a particular item | range | emit a particular range of sequential integers | repeatElement | emit a particular item multiple times | timer | emit a particular item after a given delay |
Combining Observablesmerge | combine multiple Observables into one by merging their emissions | startWith | emit a specified sequence of items before others from source | switchLatest | convert an Observable that emits Observables into a single Observable that emits the items emitted by the most-recently-emitted of those Observables | combineLatest | combine the latest item emitted by each Observable | zip | combine the emissions of multiple Observables together |
Observable Utility OperatorsdelaySubscription | shift the emissions forward in time by a particular amount | do / doOnNext | register an action to take upon Observable lifecycle events | observeOn / observeSingleOn | specify the Scheduler on which an observer will observe | subscribe | operate upon the emissions and notifications from an Observable | subscribeOn | specify the Scheduler on which an Observable will operate | timeout | abort when no item emitted during a specified span of time | using | create a disposable resource that has the same lifespan as the Observable | debug |
Connectable Observable Operatorsmulticast | publish | convert an ordinary Observable into a connectable Observable | refCount | make a Connectable Observable behave like an ordinary Observable | replay | ensure that all observers see the same sequence of emitted items | shareReplay |
| | Transforming Observablesbuffer | periodically gather items into bundles | flatMap | transform the items into Observables and merge them into a single one | flatMapFirst | flatMapLatest | map | transform the items by an Observablapplying a function to each item | scan | apply a function to each item sequentially, and emit each successive value | window | periodically subdivide items into Observables |
Filtering Observablesdebounce / throttle | filters out items rapidly followed by another item | distinctUntilChanged | suppress duplicate items | elementAt | emit only item n | filter | emit only those items that pass a predicate test | sample | emit the most recent items since the previous sampling | skip | suppress the first n items | take | emit only the first n items | takeLast | emit only the final n items | single | emit only the first item |
Conditional and Boolean Operatorsamb | emit all of the items from only the first to emit an item or notification | skipWhile | discard items until a specified condition becomes false | skipUntil | discard items until a second Observable emits an item | takeWhile | mirror items until a specified condition becomes false | takeUntil | discard any items after a second Observable emits an item or terminates |
Error Handling Operatorscatch | recover from error by continuing the sequence without error | retry | resubscribe to source when error | retryWhen |
Mathematical and Aggregate Operatorsconcat | emit the emissions from two or more Observables without interleaving them | reduce / aggregate | apply a function to each item sequentially, and emit the final value | toArray | convert an Observable into an array |
|
Created By
lidonghua.com
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets