Show Menu

RxSwift Operators Cheat Sheet by

RxSwift supported operators
ios     swift

Creating Observ­ables

asOb­ser­vable
convert various objects into Observ­ables
create
create an Observable from scratch
defe­rred
create an Observable for each subscr­iption
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
inte­rval
emit a sequence of integers spaced by a given time interval
just
emit a particular item
range
emit a particular range of sequential integers
repe­atE­lem­ent
emit a particular item multiple times
timer
emit a particular item after a given delay

Combining Observ­ables

merge
combine multiple Observ­ables into one by merging their emissions
star­tWith
emit a specified sequence of items before others from source
swit­chL­atest
convert an Observable that emits Observ­ables into a single Observable that emits the items emitted by the most-r­ece­ntl­y-e­mitted of those Observ­ables
comb­ine­Lat­est
combine the latest item emitted by each Observable
zip
combine the emissions of multiple Observ­ables together

Observable Utility Operators

dela­ySu­bsc­rip­tion
shift the emissions forward in time by a particular amount
do / doOn­Next
register an action to take upon Observable lifecycle events
obse­rveOn / obse­rve­Sin­gleOn
specify the Scheduler on which an observer will observe
subs­cribe
operate upon the emissions and notifi­cations from an Observable
subs­cri­beOn
specify the Scheduler on which an Observable will operate
time­out
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

Connec­table Observable Operators

mult­icast
publ­ish
convert an ordinary Observable into a connec­table Observable
refC­ount
make a Connec­table Observable behave like an ordinary Observable
replay
ensure that all observers see the same sequence of emitted items
shar­eRe­play
 

Transf­orming Observ­ables

buffer
period­ically gather items into bundles
flat­Map
transform the items into Observ­ables and merge them into a single one
flat­Map­First
flat­Map­Lat­est
map
transform the items by an Observ­abl­app­lying a function to each item
scan
apply a function to each item sequen­tially, and emit each successive value
window
period­ically subdivide items into Observ­ables

Filtering Observ­ables

debo­unce / thro­ttle
filters out items rapidly followed by another item
dist­inc­tUn­til­Cha­nged
suppress duplicate items
elem­entAt
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
take­Last
emit only the final n items
single
emit only the first item

Condit­ional and Boolean Operators

amb
emit all of the items from only the first to emit an item or notifi­cation
skip­While
discard items until a specified condition becomes false
skip­Until
discard items until a second Observable emits an item
take­While
mirror items until a specified condition becomes false
take­Until
discard any items after a second Observable emits an item or terminates

Error Handling Operators

catch
recover from error by continuing the sequence without error
retry
resubs­cribe to source when error
retr­yWhen

Mathem­atical and Aggregate Operators

concat
emit the emissions from two or more Observ­ables without interl­eaving them
reduce / aggr­egate
apply a function to each item sequen­tially, and emit the final value
toAr­ray
convert an Observable into an array

Download the RxSwift Operators Cheat Sheet

2 Pages
//media.cheatography.com/storage/thumb/donghua-li_rxswift-operators.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Basic Cisco IOS Commands Cheat Sheet
            Swift Cheat Sheet by Rob Phillips