<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dounia Belannab on Medium]]></title>
        <description><![CDATA[Stories by Dounia Belannab on Medium]]></description>
        <link>https://medium.com/@dbelannab?source=rss-5b7e46cc6b9e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*88txZSxjb4c7tiIrFhME3Q.png</url>
            <title>Stories by Dounia Belannab on Medium</title>
            <link>https://medium.com/@dbelannab?source=rss-5b7e46cc6b9e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:38:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dbelannab/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[My Motherhood Journey: What It Really Looked Like]]></title>
            <link>https://medium.com/@dbelannab/my-motherhood-journey-what-it-really-looked-like-0dcefece1b99?source=rss-5b7e46cc6b9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dcefece1b99</guid>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[motherhood]]></category>
            <category><![CDATA[women]]></category>
            <category><![CDATA[new-mom]]></category>
            <dc:creator><![CDATA[Dounia Belannab]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 15:29:03 GMT</pubDate>
            <atom:updated>2026-01-03T12:34:33.753Z</atom:updated>
            <content:encoded><![CDATA[<p>I became a mother already tired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*B2WhzwgjBYs3pyd66kRHFQ@2x.jpeg" /></figure><p>Pregnancy wasn’t magical for me. It was heavy. My body changed fast, I gained weight, and my mind never rested. I worried about birth, about work, about money, about whether I could handle everything. I kept going, planning, thinking ahead, even when I knew labor could happen at any moment.</p><p>After birth, life didn’t slow down. It exploded.</p><p>Sleep didn’t disappear because my baby was difficult. It disappeared because I followed what I thought I should do. As a first-time mom with very little milk, I tried to breastfeed anyway, then topped up with bottles, changed diapers, and cleaned everything after. By the time I was done, I had maybe ten minutes before starting over.</p><p>And then congestion, coughing, vomiting after coughing, teething pain without teeth, every phase came with new questions. I was always calculating: when did he eat, how much, how long ago, is this normal?</p><p>My body didn’t “bounce back.”</p><p>Months later, my body still didn’t feel like mine. My old jeans didn’t fit. I wanted to lose fat, but I was exhausted and hormonal. I tried fasting, walking, gym machines, cycling, always balancing effort with the little energy I had. I didn’t want motivation quotes. I wanted something realistic.</p><p>Emotionally, it was heavy.</p><p>I missed silence. I missed quiet time with my partner.</p><p>And yet, I didn’t stop being myself.</p><p>I’m a software engineer. I like building things. Thinking. Creating. During my baby’s nap times, I worked on side projects. Not because I had to , but because it reminded me who I was. Those small pockets of time felt like oxygen. I wasn’t escaping motherhood; I was surviving it.</p><p>Motherhood didn’t slow me down.</p><p>It divided my attention.</p><p>One part of me was always with my child.</p><p>Another part was trying not to disappear.</p><p>I questioned everything: parenting styles, discipline, culture, advice. My background versus the Dutch system. Soft parenting versus structure. What’s science, what’s guilt, what’s just noise. I wanted to raise a secure child without losing authority, or myself.</p><p>Some days I felt capable.</p><p>Other days I felt like I was failing everywhere at once.</p><p>What I’ve learned so far:</p><p>•	You can love your child deeply and still miss your old life.</p><p>•	Exhaustion reshapes you.</p><p>•	Motherhood isn’t instinct — it’s constant problem-solving.</p><p>•	You don’t get your old body back. You adapt to a new one.</p><p>•	Time becomes fragmented, not absent.</p><p>•	Silence becomes precious.</p><p>•	Strength often looks very ordinary.</p><p>I’m still in it.</p><p>Still learning. Still tired. Still building.</p><p>A mother. A woman. An engineer.</p><p>All at the same time.</p><p><em>I’m quietly building a postpartum support app based on lived experience: https://postpartum.carrd.co</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dcefece1b99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A piece of history: Skiing to Success]]></title>
            <link>https://medium.com/@dbelannab/a-piece-of-history-skiing-to-success-9e670822adc7?source=rss-5b7e46cc6b9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e670822adc7</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[scrum]]></category>
            <dc:creator><![CDATA[Dounia Belannab]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 10:07:46 GMT</pubDate>
            <atom:updated>2023-10-31T17:34:52.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ghwQ3nyhMdnRrLZ3_hyL8g.jpeg" /></figure><p>Once upon a time in a place (Utah, in 2001), a group of highly skilled software developers gathered for a ski trip. While enjoying some cocoa they began discussing their shared frustrations with the waterfall approach to software development. You know, that method of meticulously planning everything upfront and hoping for the best. As they exchanged tales of projects gone awry an ingenious idea struck them; why not create an approach to software development that would be more adaptable, flexible, and dare I say it agile? So the Agile Manifesto was born! This group of experts formulated a set of values and principles that placed emphasis on customer collaboration adapting to change and prioritizing working software over documentation. The concept of Agile quickly gained traction in the world of software development. Has since become one of the favored approaches for efficient and speedy project completion.</p><p>As companies have embraced methodologies in their software development processes they have also found it necessary to hire individuals with skills and knowledge to effectively implement this approach. This includes not only software developers but also project managers, product owners scrum masters, and other key roles crucial, to fostering an Agile environment.</p><p>In fact, a quick search on popular job websites shows thousands of open positions for various agile-related roles, from entry-level positions to senior management roles. So it’s clear that the adoption of agile methodologies has had a significant impact on the job market in the tech industry, and this trend is likely to continue as more companies realize the benefits of working in an agile way.</p><p>So there you have it, folks. The Agile Manifesto was born out of a ski trip, and some hot cocoa, don’t miss out on enjoying this winter season, you never know, you might come up with your friends with a revolutionary idea that could change the course of history!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e670822adc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Singleton: the outcast design pattern]]></title>
            <link>https://medium.com/@dbelannab/singleton-the-outcast-design-pattern-944c3da224f6?source=rss-5b7e46cc6b9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/944c3da224f6</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Dounia Belannab]]></dc:creator>
            <pubDate>Wed, 09 Nov 2022 20:24:33 GMT</pubDate>
            <atom:updated>2022-11-09T20:24:33.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*SfbsRZadWQ9B4KuNtoSU7g.png" /></figure><p>Singleton was for, quite some time, my shortcut to keep data easily accessible all over the project, I felt at some point that it was like a global container held in memory, but for an iOS app developer how bad it can be, especially that I noticed even Apple is using so much internally: UIApplication, UserDefaults, FileManager, URLSession, OperationQueue …</p><p>But when I had to do some quality control and needed to write unit tests, I recognized my mistake of not using the pattern properly. The result was: code smells, tightly coupled code, concurrency issues, painful unit testing …</p><p>In this article expect, dear reader, to find your way to answer: are singletons bad? should we avoid singletons?</p><p>If you are familiar with the pattern you can skip to the second paragraph.</p><h3>1- Quick introduction to the pattern:</h3><p>As a start let’s see what is a Singleton:</p><blockquote>Singleton: Ensure a class only has one instance, and provide a global point of access to it.</blockquote><blockquote>— Design Patterns: Elements of Reusable Object-Oriented Software GoF — 1994</blockquote><p>Singleton is a software design pattern that restricts the instantiation of a class to a single instance, easily accessible across a system. How is that done ? by hiding the constructor (making it private) and providing get access to the unique instance. Like below.</p><pre><strong>class</strong> Singleton {<br>    <strong>static</strong> <strong>let</strong> shared = <strong>Singleton()</strong><br>    <strong>private</strong> <strong>init()</strong> { }<br>}</pre><h3>2- Singleton usage</h3><p>As mentioned in the definition of the pattern, it should be used only if a class needs exactly one instance that should be globally accessible. Here comes the tricky part, the use case of the pattern is not as often as it is used, and it is used mostly out of laziness not a necessity.</p><p>Let’s check together some poor justifications to use Singleton</p><p><strong>When an instance of an object is needed as an argument in many places, </strong>this can be solved by answering one question: are our components respecting the single responsibility principle (SRP)? if yes, and the object is really needed then we only need to inject it (dependency injection), if not then our components are tightly coupled and better to refactor.</p><p><strong>Ensuring that there is one instance of an object, </strong>this one might seem very close to the correct use case but it is not, because it is more related to creating one instance, the class itself doesn&#39;t need to insure this by becoming a singleton.</p><p><strong>Shortcut to deliver quickly, and avoid an endless loop of rethinking the best design, </strong>in this case, it is obvious that the pattern itself is not guilty of the boilerplate coming from a humble design at all. It might be a quick hack to unblock delivering the project, but it can always be refactored afterward if possible or just accepted as a dept.</p><h3>Conclusion</h3><p>The pattern has been wrongly used by many developers, myself included, that it ended up looking like an anti-pattern. But the main reason is that real use cases are extremely rare I still never faced one. That’s why, before opting for it, we need to think long and hard because the chances that are not really required will be pricey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=944c3da224f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apple’s new solution for Data races: Actors]]></title>
            <link>https://medium.com/@dbelannab/apples-new-solution-for-data-races-actors-bbc709c7abf?source=rss-5b7e46cc6b9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbc709c7abf</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[adidoescode]]></category>
            <category><![CDATA[data-race]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[concurrency]]></category>
            <dc:creator><![CDATA[Dounia Belannab]]></dc:creator>
            <pubDate>Fri, 22 Jul 2022 22:27:28 GMT</pubDate>
            <atom:updated>2022-07-22T22:27:28.755Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wjzCw4cSYvKjk6dWKm3zpQ.jpeg" /></figure><p>EXC_BAD_ACCESS does that sound familiar to you? Yes? then data races must have been a nightmare to you, starting from the confusing crashes, to undefined behaviors and flaky tests. If your answer was no, then you will learn about one of the most famous problems in <strong>multithreading programming</strong> and Apple solutions for it.</p><p>Let&#39;s start from the beginning,</p><h3>1. What is a Data race?</h3><p>A data race happens when these three conditions happen together:<br>a. two or more threads in a single process access the same memory location concurrently,<br>b. One of the accesses, at least, is for writing<br>c. the threads are not using any locks to control their access to that memory</p><p>Let’s use the example below to understand more in a Swift context:</p><pre><strong>class</strong> Hotel {</pre><pre>   <strong>private</strong> <strong>var</strong> availableRooms: [<strong>String</strong>] = [&quot;110&quot;, &quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</pre><pre>   <strong>func</strong> getAvailableRooms() -&gt; [<strong>String</strong>] {<br>      <strong>return</strong> availableRooms<br>   }</pre><pre>   <strong>func</strong> bookARoom() -&gt; <strong>String</strong> {<br>      <strong>let</strong> bookedRoom = availableRooms.first ?? &quot;&quot;<br>      availableRooms.removeFirst()<br>      <strong>return</strong> bookedRoom<br>  }</pre><pre>}</pre><p>We have a Hotel <strong>class</strong> with available rooms and two functions:<br>- <strong>getAvailableRooms</strong>: which returns the available rooms<br>-<strong>bookARoom</strong>: which removes the first room from the list and returns it</p><p>Now let’s consider we have 2 queues one to print the available rooms and the other one is booking a room and printing the result:</p><pre><strong>let</strong> hotel = Hotel()</pre><pre><strong>DispatchQueue</strong>(label: &quot;queue1&quot;).<strong>async</strong> {<br>   <strong>let</strong> bookedRoom = hotel.bookARoom()<br>   <strong>print</strong>(&quot;Booked room is: \(bookedRoom)&quot;)<br>}</pre><pre><strong>DispatchQueue</strong>(label: &quot;queue2&quot;).<strong>async</strong> {<br>   <strong>print</strong>(&quot;Available rooms are: \(hotel.getAvailableRooms())&quot;)<br>}</pre><p>After running the code this is what I got:</p><pre><strong>Booked room is: 110<br>Available rooms are: [&quot;110&quot;, &quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</strong></pre><p>But if we booked room <strong>110 </strong>then shouldn’t it be removed from the available rooms. This is a <strong>data race </strong>case. The hotel object was accessed by two threads at the same time and one of the threads performed a write operation.</p><h3>2- Apple&#39;s previous solutions for data race</h3><h4>2.1 Immutable state</h4><p>A data race is caused by shared mutable states, which means if instead of the <strong>variable </strong>availableRooms we had an immutable <strong>let</strong> we couldn’t have a data race case.</p><h4>2.2 Value semantics</h4><p>Another way Apple suggests to avoid data races is, by using <strong>value</strong> <strong>semantics </strong>since the changes in a value type are local. If we change our Hotel <strong>class</strong> to a <strong>struct.</strong></p><p>We will need to mark bookARoom method with <strong>mutating</strong></p><pre><strong>mutating</strong> <strong>func</strong> bookARoom() -&gt; <strong>String</strong></pre><p>Now if we try to run it again, we will get a compiler error because the hotel is a <strong>let</strong> which stops us from mutating it. If we change the hotel to a <strong>var </strong>then we will have a race condition because the hotel will be referenced by the two tasks and we don’t know which one will happen first. Still not enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5HhZ5DQA8i1ICjFSjXjp_Q.gif" /></figure><h4><strong>2.3 Diagnostic</strong></h4><p>To detect data races Apple provides in Xcode another amazing LLVM family member: <strong>TSan (Thread Sanitizer)</strong>. To enable it you can navigate to Product&gt;Scheme&gt;Edit Scheme and then Run&gt;Diagnostics and check the Thread Sanitizer checkbox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLSUXK1XmFEw7FTwKTiuEQ.png" /></figure><p>With the TSan enabled, when I run the code I get a runtime warning saying that a data race occured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5AhgybYwg3Zy1ZLWj7cLA.png" /></figure><blockquote>One thing to keep in mind about TSan, it can slow down the CPU up until x20 and increase memory usage up until x10.</blockquote><h4>2.4 More solutions</h4><p>Apple provided some tools to synchronize shared multiple states:<br><strong>a. Low level:</strong> Locks and Atomics<br><strong>b. High level:</strong> Serial Dispatch Queues</p><p>Let’s stay on the high level, and solve this problem with Dispatch Queue by adding a barrier:</p><pre><strong>class</strong> Hotel {</pre><pre><strong>   private</strong> <strong>let</strong> barrierQueue = DispatchQueue(label: &quot;barrier&quot;, attributes: .concurrent)<strong><br>   private</strong> <strong>var</strong> availableRooms: [<strong>String</strong>] = [&quot;110&quot;, &quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</pre><pre><strong>   func</strong> getAvailableRooms() -&gt; [String] {<br>      barrierQueue.sync(flags: .barrier) {<br>         <strong>return</strong> availableRooms<br>      }<br>   }</pre><pre><strong>   func</strong> bookARoom() -&gt; <strong>String</strong> {<br>      barrierQueue.sync(flags: .barrier) {<br>         <strong>let</strong> bookedRoom = availableRooms.first ?? &quot;&quot;<br>         availableRooms.removeFirst()<br>         <strong>return</strong> bookedRoom<br>      }<br>   }</pre><pre>}</pre><p>If we run again, we will see this:</p><pre><strong>Booked room is: 110</strong></pre><pre><strong>Available rooms are: [&quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</strong></pre><p>The data race is solved, but as you can see we have a lot of manual intervention (added the new barrier, changed logic by adding sync blocks, added flags), doing this every time may not be the best thing to do because it may lead to errors and if we don&#39;t handle it correctly we will be falling again in a data race.</p><h3>3- Actors</h3><p><strong>In computer science</strong>, an actor is a fundamental unit of computation that can handle its own private state. Actors are isolated from each other and don’t share memory. They have a state and the only way to change it is by receiving a message through a mailbox, and those messages will be treated in FIFO.</p><p>Apple in Swift 5.5 provided a new kind of reference type and named it <strong>actor </strong>also. Actors were marketed by taking care of all the concurrency without adding any logic-related code. They can handle mutable and immutable states as they should be handled. An actor can have properties, methods, initializers, and so on. It can conform to protocols and be augmented with extensions. The one difference with a class is that an actor can’t inherit.</p><p>Let’s bring back our example, and change Hotel from <strong>class</strong> to <strong>actor</strong></p><pre><strong>actor</strong> Hotel {</pre><pre><strong>private</strong> <strong>var</strong> availableRooms: [<strong>String</strong>] = [&quot;110&quot;, &quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</pre><pre><strong>func</strong> getAvailableRooms() -&gt; [<strong>String</strong>] {<br>      <strong>return</strong> availableRooms<br>   }</pre><pre><strong>func</strong> bookARoom() -&gt; <strong>String</strong> {<br>      <strong>let</strong> bookedRoom = availableRooms.first ?? &quot;&quot;<br>      availableRooms.removeFirst()<br>      <strong>return</strong> bookedRoom<br>  }</pre><pre>}</pre><p>We will see a compiler error on the queues, saying that the two functions are Actor-isolated and can’t be interfered from a non-isolated context. Which is the expected error we should see. Let’s say we have a computed property that doesn’t need really an isolated state like:</p><pre><strong>var</strong> name: <strong>String</strong> {<br>   &quot;Hotel Midnight&quot;<br>}</pre><p>We can solve this by adding the keyword <strong>nonisolated </strong>and the compiler will understand that the property is not an object to concurrency.</p><p>I changed dispatch queues to Tasks which works similarly to it. I also made use of await for calling the methods as asynchronous and imported <strong>_Concurrency. </strong>Now, this is what our code looks like.</p><pre><strong>import</strong> Foundation<br><strong>import</strong> _Concurrency</pre><pre><strong>actor</strong> Hotel {</pre><pre><strong>   private</strong> <strong>var</strong> availableRooms: [String] = [&quot;110&quot;, &quot;111&quot;, &quot;112&quot;, &quot;113&quot;]</pre><pre><strong>   func</strong> getAvailableRooms() -&gt; [String] {<br>      <strong>return</strong> availableRooms<br>   }</pre><pre><strong>   func</strong> bookARoom() -&gt; String {<br>      <strong>let</strong> bookedRoom = availableRooms.first ?? &quot;&quot;<br>      availableRooms.removeFirst()<br>      <strong>return</strong> bookedRoom<br>   }</pre><pre>}</pre><pre><strong>let</strong> hotel = Hotel()<br><strong>Task</strong> {<br>  <strong>let</strong> bookedRoom = <strong>await</strong> hotel.bookARoom()<br>  print(&quot;Booked room is: \(bookedRoom)&quot;)<br>}<br><strong>Task</strong> {<br>  print(&quot;Available rooms are: \(<strong>await</strong> hotel.getAvailableRooms())&quot;)<br>}</pre><p>Tad-a! And this is how we prevent data races using <strong>actors.</strong></p><h3>Conclusion</h3><p>Apple gave many possible solutions for data races, but <strong>actors</strong> are definitely a big plus to the Swift concurrency module, helping the developers write safer asynchronous code, with very little effort, and also detecting any race conditions during compile-time.</p><p>Thank you for reading,<br>Cheers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbc709c7abf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xcode Debugging tips and tricks]]></title>
            <link>https://medium.com/@dbelannab/xcode-debugging-tips-and-tricks-c2f4db49553e?source=rss-5b7e46cc6b9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2f4db49553e</guid>
            <category><![CDATA[lldb]]></category>
            <category><![CDATA[adidoescode]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Dounia Belannab]]></dc:creator>
            <pubDate>Thu, 26 May 2022 22:49:42 GMT</pubDate>
            <atom:updated>2022-05-26T22:49:42.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*y1dtlCSe2RYjvbK_JqWsJA.png" /></figure><p>As a lazy software engineer, I always look for shortcuts to complete my tasks. And since we spend half of our times debugging let me share with you some debugging tricks I learned in my last programming years or should I say debugging years.</p><p>For this article lets assume we have this simple struct:</p><pre><strong>struct</strong> User {</pre><pre><strong>   var</strong> name: <strong>String</strong> = &quot;Hermione Granger&quot;</pre><pre><strong>   let</strong> birthdate: <strong>String</strong> = &quot;September 19, 1979&quot;</pre><pre><strong>   var</strong> city: <strong>String</strong> = &quot;London&quot;</pre><pre><strong>   var</strong> description: <strong>String</strong> {</pre><pre>      name + &quot; born in &quot; + birthdate + &quot;. Currently living in &quot; +     city + &quot;.&quot;</pre><pre>   }</pre><pre>}</pre><pre><strong>let</strong> user: <strong>User</strong> = <strong>.init()</strong></pre><h3>po command:</h3><p>Which is the most famous one, is an alias of “expression — object-description ” printing the description method of the given argument within the scope of the breakpoint.</p><p>The good part (but not always good) of this one is that it can also execute valid expression and print the result. For example:</p><pre><strong>(lldb) po user.city.uppercased()</strong></pre><pre>&quot;LONDON&quot;</pre><h3>p command:</h3><p>This one is another way of printing out variables and is also an alias for “expression ” but without the “ — object-description”, the difference is that p command will print the whole object with a special convention name in lldb: $R0, $R1,.. meanwhile po will print the debugDescription of it.</p><p>p command does also the compiling and the evaluating part from po, but once it gets the result it, lldb perform a step named dynamic type resolution. This is how it looks to print the object with p command:</p><pre><strong>(lldb) p self.user</strong></pre><pre>(lldbDemoApp.User) $R1 = (name = &quot;Hermione Granger&quot;, birthdate = &quot;September 19, 1979&quot;, city = &quot;London&quot;)</pre><pre><strong>(lldb) p user.description.uppercased()</strong></pre><pre>(String) $R2 = &quot;HERMIONE GRANGER BORN IN SEPTEMBER 19, 1979 . CURRENTLY LIVING IN LONDON&quot;</pre><h3>Symbolic breakpoints</h3><p>Which makes the debugger pauses when the app or your code calls the symbol you specify.</p><p>To create a symbolic breakpoint click on Breakpoint Navigator and another click on + symbol at the bottom-left corner and select Symbolic Breakpoint as an option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*VEAD71XRXOlgoSGE-OZqiQ.png" /></figure><p>Xcode will pop up all the places where the symbol exists in the Breakpoint Navigator, and will create a breakpoint for it even if you can’t see it established when navigate to that line of code directly.</p><blockquote>Now, let’s move to my favourite ones.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*lxMHRu7ZxYh_e9OtGN1wkw.gif" /></figure><h3>v command:</h3><p>This one is an alias for “frame variable command”, available since Xcode 10.2. v command is significantly fast <em>(especially for those 10 minutes to build projects)</em>, because it doesn’t compile or execute code at all. Which means it can only access variables in the current stack, no computed properties no functions or method calls. Let’s try v command</p><pre><strong>(lldb) v self.user</strong></pre><pre>(lldbDemoApp.User) user = (name = &quot;Hermione Granger&quot;, birthdate = &quot;September 19, 1979&quot;, city = &quot;London&quot;)</pre><pre><strong>(lldb) v user.name</strong></pre><pre>(String) user.name = &quot;Hermione Granger&quot;</pre><pre><strong>(lldb) v user.description</strong></pre><pre>error: &quot;description&quot; is not a member of &quot;(test.testApp.User) self.user&quot;</pre><pre><strong>(lldb) po user.description</strong></pre><pre>&quot;Hermione Granger born in September 19, 1979. Currently living in London.&quot;</pre><p>As you can see above v failed to output the computed property description while po did. This required code to be compiled and executed which the v command does not do.</p><h3>expression command:</h3><p>For most of the projects it takes a while to compile, and to debug a possible fix like disabling a toggle or editing a colour you can inject code without the need of re-building or re-running using the expression command. Let’s make use of our struct once last time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*XnKTU85QbDOrJqx_ZOwE1A.gif" /></figure><p>First we need to change the user from let to var,</p><pre><strong>var</strong> user: <strong>User</strong> = <strong>.init()</strong></pre><p>And then ready to go:</p><pre><strong>(lldb) expression user.name = &quot;Ron Weasley&quot;</strong></pre><pre>() $R0 = {}</pre><pre><strong>(lldb) po user</strong></pre><pre>▿ User</pre><pre>- name : &quot;Ron Weasley&quot;</pre><pre>- birthdate : &quot;September 19, 1979&quot;</pre><pre>- city : &quot;London&quot;</pre><p>The expression can also be configured to be executed each time you hit a breakpoint.</p><p>For that you can add your breakpoint, and double-click or right-click on it to see a small configuration window, then click on Action and turn it to “debugger command” and then inject the code you want to swap at the time of execution.</p><p>To make the debugger continue without pausing on that line you can select the “Automatically continue after evaluating actions” checkbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*N4yNYtnjMsaykzALXI3o9g.png" /></figure><p>And voila, you code is evaluated and executed in runtime.</p><p><em>Happy debugging, folks!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2f4db49553e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>