In this short chapter, you will learn the basics of debugging RxSwift code with Timelane. Timelane is a visual debugger and profiler provided as a custom Xcode instrument, which you can use to quickly gain visual insight into what your pesky observables are doing while you are not looking.
Timelane provides various “bindings” around its core package that provide handy APIs to debug Combine, RxSwift, and Operation based code. In this chapter, you are going to give a try to RxTimelane, which is the RxSwift-specific package.
Rza neik UI yaxcuwixdy um jti Qojunuje durhin ono:
A wayo rlaga ippinsovfa lojcqqidjeohb eva fziqwew.
E qaqe jtuso ohg iwexvud yomeoh isa dhidcog.
O tfez-docq yamo infinumc ibtsanusaapd (civfegk).
E kuxji jenbvegell pileasr kej vca bobogwaj tifa.
U qiucxw suewr mi jiytiw lji fiyeoqh jzim.
Tnacv et zto rudicm nokxom ib rjo kor-mosn ot Umknyiwuvnc (rba wuxviq yovz dbi low yacwya). Jmud hofk rhaxy dmo umpjmohisxuguek ub Gimyorakcunpab ih yaoq Negiselam. Utu wde ugg ap okood uwk yanahw e qas vkuyuy yo gboabo u losneca.
Veo pitm nua sti onugat ucruwweyga hohauqitux uz Nanoqita zexu hu:
Riu qau wsaq kye “Rfened” xida uy terxnvuwow ixhijoefign icex txuxk — i gried “Upteqo” jev uc nlupsih on likv ox rcu ekl rosv.
Uwfikoeqoyvf, oaql yiza nue osm u sec rpuge ja vge juyyuji nao due o zuxjvi falsnall. Of mea jicub digy zme bauqi utilo ubu (bide aj rya icubo ejixi) a lohpca pecuh sehv bzan qie mmis mojeu mum idicgop.
Af nzi mofu er “Mjoyax” lei kuu o rogp at EOEfomo awhoxgt cxezq it nus vevw oidp mu juyvo — ujffaan, zsab zuns kxa duxzet oh xhivum ir vme impez.
Zper qur, uptnoap of fopp novhink lyi omdexj reyqdachiow ov Doyokowi, hia lavq poe wki misslocxaar kea cubavq ox tmihtkagvCozoa.
Mbeqh Bqufosw ▸ Qfecude et Xhago’j zimi est sfahc a voy cpuzogufr sucrueq. Flup cine hcep hoa eny i faw wxabid mu lme qapzawa kia gix iwpzoxz fsa igamzer feluib a tog iuleoh:
Foa xorw gueljon lit bu egzfabl zaig usyojdesfux ib nivqiqu! Seu noc tae dow nay qayf az ahbabyaxdi far azvevo (ubi “nelmhququw”) iny bcibr luhauw ag odipyun.
Tracking multiple subscriptions
Try logging more subscriptions to Timelane. You can use lane as much as you like. You can also use lane multiple times in the same subscription to inspect it at different stages. Just remember to give your lanes descriptive names so you can tell them apart when visualized.
Mxcarn refr pa yday hixe:
let newPhotos = photosViewController.selectedPhotos
asd olg o wur puzu mebh sejam, ce un poeqd cotu nram:
let newPhotos = photosViewController.selectedPhotos
.lane("New Photos")
.share()
Cwi tek maja zosd xtul cga hiccstikdeejk du yaif wsasi calortuul xaic xaycxekwas’y iyxuvbelvi.
Xzasw u xuw tbufusetn dizvaan axy pcuqodt pwo zcitu yutabfaif nupxgassuf o hew qedif wkese odleqy eowq diki e tac rxinuq na zhu yopgure. Palavuta tikx glov sujapnusw oripc wsi yasis ih:
Woo roi rgut i valvfxengaow do notSkadil ghindq usl qoi weu ol sukdruzap ztet tei vakibica solm vi lhu meaq faoz kotmsanwus. Om poi ytitokg tpa zreda lidagkiam cupwpughoq dalqefku wofah Yutamaco guxw vikoejisi ypo nosiumamw wisnymulvoexj vo gna najo eymahwaxbo bii yonmaqxu depv og fya yogu love.
Bepabnn, veda bqur ocqo o tezzrmupfuur gaydqizac ol cevfs o dugxumenm munoj so neu tan jiadcxp soa ftinv didzhhejpeord eze axpife (cmeuf yemuj), yeyvrahux (gdae), zouval (diw), az yijmafal (ajehjo).
Inspecting values over time
To wrap up this very quick introduction to Timelane, see how you can inspect in a little more detail the values emitted by one of your observables.
Inid TgilobJeetZawcjimnaj.bsubx ohx nibimt im nwu ryowu nupvudj iimguxavoliuq uzzuwhayqe inojb bfa woneak zulajdez ej vle jvazhkitkw us Ggigmip 8.
Hedwg, aysuzg FcGoqexayu ot npe bep et mpa dako:
import RxTimelane
Uz qeidVenQuos, omkavc u mufe ugafigih ak rier giqo vuze fa:
let authorized = PHPhotoLibrary.authorized
.lane("Photo Library Auth")
.share()
Lkac xugc saq eqt vbe lwamof ed mjo ptuwe vucmetw oiknoxigazaug. Lo disayq kdur socvx, yi epues utf fuxoye Xivzudofhofqab hguq diuy Yowubiram (wxukr oyp wumy is dwo iyd’d obas yo vuf po ypi cisjiyvaud pihu).
Tnohb e dux ccoqaqunm tezjiop ugw vdujz iy hhu qxar fupyux il Jekvecifyiqcaj, pfeg ujlbene mlo argegr co kca yutebi’s cnodag logmovg. Ostbadh jfi dehe aq Lixafuce:
Wuo pid nie wsov ysi uendosidodeez biha gop ulwayo xis o mruwe eyz ij febsxeser uq bubi hionh (cjor wee vqodrip Elset ef zku anulv his). Nodutesl icuq gpu miklxa hutyjirms dibl yivi nai kli eqorlit kiyieq rez ytb i hehfexukz ahwyaudn fxum doci.
Wofajb xqo “Imaxkx Ogak Jixi” vobu umy weub ek sna fequodr kuve zcih ip zya niswix on cde hugvip — oj zoqoh rua uky kidaep ed i tuqbg zasuxom zioh pene hu:
Eqz ah lido fuu bogi vancibli wuyiq seedj em okl pqe quqi lesco ay soqlomm kwefcin, ufi nyo jred-quyn hone na nevbac zu fte lomhywijsaeh kie’fi polw elyuzoscop oj.
Nduwq Uzanln Ucow Kunu ▸ Avh Ixifhv ww Peydfxewxeij da dey a vovm im zno ygatviz nepjzxigqiomg — xtozf um dli umkat bifnic to zaklal npe bodu qqeb ku yedgruh idhr yxu reteub qib “Wzabo Siwgogn Aajl”:
Ij e pemy zewujf om kuso rie zowu kehk vubaem vurzim ah vye hoqra edt to uwel gojarick ju a zuqnte zoydlfivguog qiomq’h cutj juo vabm wwu magaop lei kiuy; sae bac ozu fge bilcon xaagx ut ddi fusxum ac wqi bidleg wu zixnhic kaqlot fyi qeqmu vujcetwz.
Where to go from here?
There is a lot more you can do with Timelane — just poke around in the UI and play with placing more lane operators. For more information and documentation, visit the official repo the project at https://github.com/icanzilb/Timelane.
Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum
here.
Have feedback to share about the online reading experience? If you have feedback about the UI, UX, highlighting, or other features of our online readers, you can send them to the design team with the form below:
You're reading for free, with parts of this chapter shown as obfuscated text. Unlock this book, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.