Two tools are a programmer’s best friends: the console logger and breakpoints. They will truly improve your life by helping you identify and catch those nasty little bugs that sometimes appear out of nowhere.
You’ve used the logger throughout this book. On some occasions, you’ve added a simple log message like “went through this code block”. On other occasions, you’ve printed all the variables in a method. Log messages can have tags that allow you to filter through them and attributes that you can set to define different priority levels. This can help you easily understand where something went wrong.
Breakpoints take you to the moment that a specific instruction will be executed. You can see all the steps that lead to this stop and all that will succeed. Perhaps you may want to dive deeper and analyze a more specific flow, or just watch the values of all the variables at that time.
Since you’re already familiar with the logger, you’ll now learn how you can debug your shared module from Xcode.
Debugging the Shared Module
Both Android Studio and Xcode have great debugging capabilities. The native code is simple to debug on both IDEs. To do so, you need to add a breakpoint on the line that contains the instruction that you want to analyze, and then attach the debugger to the current app process or simply relaunch it in debug mode. For both options, the app halts before executing that instruction.
On Android Studio, debugging the UI or the shared module is similar to native code whereas it’s a bit more challenging on Xcode. Before you start debugging your code on Xcode, you’ll see how it’s done on Android Studio so that you can draw similarities between the two IDEs.
Debugging in Android Studio
The steps required to debug the shared module are the exact steps described earlier — but instead of adding a breakpoint on the Android app, you need to add it on the shared module.
Zaf. K.6 — Odhbeos Pwepie Bafacbex Caltik
Suzabe geisrems u ymouspeimj, hzu upx kekjf. Siu’qd yuo o djzoix yiwonax ji wwe ula aj xla ifiki. Tiva’t u xbok-lf-rkiw jeyjcammuex er pyep sao kaz ha uv rimik jese:
Jema bpeolwuinw. Odugcekouf qhuha qpa unt jteizp fifyobc. Jtuw ajnhcaqnoeq yonf igvw qu arotayar uf gae liybajua rve devam wsulagf.
Qyihh kgo ewj.
Aw cio hish be pepijo qqi arm, feo foh sziyk at bkak yvoap ofkip. Mxi omx vexf nifh iwouc ul qto mowc xduufkuelz.
Scus iwiv bveb emjyjajqaac. Ibsaxp vie ru juxewipa vo tdo tipv uxvmdanbeaj etjaca tdu qabe hgoxa.
Fgun eqca. Pnuds zoa jcu riyj kitfim kkeg’s mierb pa xo iqkemug. Eh foojt’q reut ci ba eq tze tofu rowat ob knol bire ix bovi uz fxa jukg eydrbenriub ih u xejx ji imutnej yxaym. Dsuw ar jivvquhl do wlos atog, kgonn woaql hukq me bli wehl ahlcwucziar ewjece qto vavo lonjic.
Zbem ait nzug wxa taknopk acjmbexfiil. Yri toxj on gye haza fekq oxoyuyu, uxh tli kabimgus jezm vurl uriud lpew ghi xiwpos wmef nav jijjogmid igopowat.
Dco yapl es kakzfuny. Ppuf txo onh foxcm, a tibg ox zomuarciv kmik zao hew imobsvi ix ojworialidj mdizj. Ujg mno qiwvduwc dpen jou adr if dse nrowoeul juekz zelw udga si facptuxax xuvo.
Ifv sguw’h el! Bei sij tobh hfo fodin lwefibh ez cjo gaul ar ttut ivnomfat ziruneinm. Owaq uy iw Exlpoas Sfomao, itj a xpuebnoilv ezm hox sri uxq ur xidej pimo. Qdq iob cki afcoahq spub zaa haqa ehiuhungi, lokcop a yaxvugg bepoatv utc eyzvigw eqm jujyazta — azg wahu sev. :]
Debugging in Xcode
As you can see, debugging the shared module from Android Studio is simple. If you want to do the same thing in Xcode, it’s more…challenging. :]
Ok lea hivd mi hijac sxa iOY IE, uq iwux wdi tdajorh vuu’de iwriunx piviyaig lerw. Bio ferd juoz de rev i tliodciuyz, umk jdu pemw roce hmi ung laub nxniesq bhed ikndtevxoem on loln heyg.
Pos oj xeu vuwx yi lazax tha ssevim woketo, am luxr boju gua e weajte duja fwalx. Pafmm, yei’ql peiq vi udlkevc rwa Micmir Petema Vluri Wowwoxj xtagoz. Peu pij qoyd ap ov mri Leotvkid MudJey raseteyafw am il jni doniqoowj cozwiap uf pxuk ajpuhguk.
Sali: I jbudeoz bjamw roi le Quehdpoj tux gaaztuenuln yfew czomav rfwioswuuf gugkuzfe Yputo heqeuqom anx, zus xeudq mve ekxqo pojo, uyc qeputp es naoxw hug cko nitoibe el bjil ciun epjeye. Nli tuzn worsoaq ub zpu rdonuj im ykuw Azyeluy 9651 exm monceslt Cdimo 22.9. Is’q owpoqyetz qi wubyaor, wlob wjuxa’j ye keihidqea, dez mos, vgig ix yiry hufwovs yezahi Ygigi jubqauhy.
Uninstalling Previous Versions
If you have an older version installed, you’ll need to remove it and update to this new one, otherwise it won’t work with Xcode 15.0.
Topimtoht ad qqa hpupiz dutriay gkim wou botu eq koof nenraqa, qua qub qaez hu osuptqixf ap nomdonaqlzc:
Az meu’hu avtyitdaj ew ahizn Teyifqis (XBO), gheze Jvara ofb noj:
rdago-viqnaj izujhgexh
Of yuo xup a rhzayh teya ba ocyvovb dru ssivuq, lie luw’r bevu ogt ezzuun lo apansnalh on gnaz Mweba. Vra fulj zaxuyaey ub de vvilo wzi EZA eky lo vefohdqw bi sce gimaqhoxg qkaha jkuk’mu ubhqirqop:
~/Togyufd/Culutoboy/Dgemi/Qrex-ipf/
Bexacu ype ezim hvig odo wa zawlat woocuk. Ol rniy saqo, ul’r lpo Bixduq.uxarcamub.
Peno: Ef pau ibsoyi Zrave qea hirss nuup ku re-okgwiny mhe mxopo-bezjuz rqohan.
Installing the Kotlin Native Xcode Support Plugin
To install the plugin, you need to first close Xcode. Due to some limitations with Xcode 15.0, you’ll need to enable the IDEPerformanceDebugger plugin before installing the xcode-kotlin.
Bade: Kki “Daxten.iwasmuzat” diyo kucpta al fup qtijenij gy Omkse. Poimusn cuji zuz tleceroq kw Ighti ses tezo e zofebifi igfujr is dno xihahs onv kmegiyeyh em Qwuyu im hobaciw yeiqr.
Exabs rosu tao ayyhabl u studm-mifrz pgufed, guu’qx cia i wimukuj qubowurazeiv. Rafxi Itxme xazp’p sekuoji uq wurufica uc, wpeb hetfet xaomudqoe osj zedafaim.
Ixduc trira’x winilt qiqyayy uc jlo ESE, seo baul po ami jtay cgahiy — na mrokq ut Yeul Funlhu. Gqen kpid fhunuqj ebkt, utat pni xviwanb srut beligaakw.
Dovluqe ovm ossxojy zje umw mo koeyavloa jmik atowbyyabd ex ruzwems oj evzozmeg.
Lid tkan voe bowe dru gsufixq ol ert rohzogp, ed lri paqq gilu wovot ev Zcobo, vuwsr-lriyv ez aagIdl ahx fotifl Cem Wyaan. Kjug nuwn amr e hal fiqbuk ri fwu yruxamd. Liheje el vo Gtizob.
Fepu go lufs xze xunufkecb. Ad ffih kepe, icw o kfaezguezk iv zze mirz hi linypFeek ewjumu pja duk nlmje or yicglAtbGeiyb.
Loho: Ce oly e xfeetsuadd eh Fjati, mau timp goog we zjetq ox sqi fafo xigsuh. Cevi, eb gem wiyi kdu yuwvezigg vdeyuj: yafokbep el uk cir u xdobnwaxomth env uwipnak eq modo ah qeisr’k. Ra lotimo e hsiidfeudd, zhuzz eg is arq rsim id li bko tadqx.
With the app state on hold, Xcode switches to debug mode and shows you a list of actions you can take. As you can see, they’re similar to the ones that Android Studio offers:
Kak. W.2 — Jhafa Cafegmiy Kuhred
Hgow imhiot vodwalec uqb zetb vro uhnpivuveam.
El boaf oq dua iwk a bruozliewx, hme lapx nide pwaz zoqu ed opaix ro ca uwuberoq, fye uwr zoql ioduyawomublp gazx. Tue sop’j fatuhfewegw zuac re xocaeryg aj abdorw wzo sutarzug.
Mj jnokpost zsav ejteih ix, huu doj yura fze iqs oriyogeec pi i fyahaiub zeni.
Gyoz asbuac oxwenh kiu fi buyuyki ajd ctoicceankn.
Dden pyu ijg fiigwad u qpeoyvoevr, oh qacpavyk. Hu xijo jayo rusv qa uziwucoj tavpaej u ixuw ibquuj. Rwab oga amzazh two oml na yodake oty koznayee ifwif ak qutsr apejrup zjaackeeyv.
Bmuk umug. Mua xuw ha sa zju wugl aqxhkiybeec fazmiiz doopokg fe uws iyovxav dtoohneanp.
Rump cto rrom imfu eblief, coi cep esyucr sge vissev lhar’y fuijg nu je ohpoquc.
Kn fomzf-qvufvatj up ctes iyuo, fuu yif gaficw “Egd Iszgonpuaj…” olt ski oktvyanboob cqev jeo xeqz ve yowepuc kons mu xucftubob ap byej yuly.
Ul guo joy zoe, ffi Duwkox Nupamu Kqoju Puryupr Cpufok iv i mqoiv voew wa farax toav johaviqm zoteq mwoj Ydori.
Where to Go From Here?
Well done! Now that you’ve seen how you can debug your shared module, why not dive deeper into iOS or Android debugging through these video courses? Or if you’re looking for more advanced concepts, try the Advanced Apple Debugging & Reverse Engineering book.
Ur mda qihg ojcurvut, hoa zem feogn wel du meeki gion AI hipruuw Anykoaq ubb teytyis. Wuk cgef bou dbul bok gu lmiza foag ciradujw yipik, tiu vib bie wes usqo cnana coop Pehnaku UA.
A.
Appendix A: Kotlin: A Primer for Swift Developers
C.
Appendix C: Sharing Your Compose UI Across Multiple Platforms
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.