<?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 Bogamythrai on Medium]]></title>
        <description><![CDATA[Stories by Bogamythrai on Medium]]></description>
        <link>https://medium.com/@bogamythrai?source=rss-e4d2fc0ebdc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gaTDp9ORf0ID8mtMDs_JBQ.jpeg</url>
            <title>Stories by Bogamythrai on Medium</title>
            <link>https://medium.com/@bogamythrai?source=rss-e4d2fc0ebdc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 23:49:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bogamythrai/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[The Bundle doesn’t contain an app icon for iPad…]]></title>
            <link>https://medium.com/@bogamythrai/the-bundle-doesnt-contain-an-app-icon-for-ipad-0625fbfc5d68?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/0625fbfc5d68</guid>
            <category><![CDATA[app-icon]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[alternate-app-icon]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 14:47:58 GMT</pubDate>
            <atom:updated>2026-01-22T14:47:58.021Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever faced the following warnings from App Store submissions<strong>?</strong> <strong>Then you are not alone…</strong></p><blockquote>The bundle does not contain an alternate app icon for iPad of exactly ‘167x167’ pixels, in .png format for iOS versions supporting iPad Pro…</blockquote><blockquote>The bundle does not contain an alternate app icon for iPad of exactly ‘152x152’ pixels, in .png format for iOS versions &gt;= 10.0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MQZEoq-VoDgEcVir3SZEQ.png" /><figcaption>image 1</figcaption></figure><p>I tried to search for the problem on the internet. But Apple hasn’t published anything on this topic. No sessions from WWDC, nor documentation (or at least not that I could find).</p><p>After hours of head-busting and hair-pulling, I found a statement, <em>‘App store validator can be extremely picky. For </em><strong><em>Alternate Icons, </em></strong><em>the most reliable way to fix this is to be explicit in </em><em>Info.plist rather than relying on the system to ‘guess’ the file names.’</em></p><p>I observed the required icon px in the App icon set are 167 -&gt; 83.5@2x, 152 -&gt; 76@2x. So, I added these icons to the project repository (not the <em>image.xcassets</em> as stated in the warning). Refer to image 2 for understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkExGvVvCMsGszcpNq44cg.png" /><figcaption>image 2</figcaption></figure><p>Mandatory setup is to have the images in the sizes of 167x167 and 152x152, named respectively as <em>your-custom-icon-83.5@2x.png</em> and <em>your-custom-icon-76@2x.png . </em>For other missing icons, you can follow a similar approach.</p><p>Final Info.plist should look like…</p><pre>&lt;key&gt;CFBundleIcons~ipad&lt;/key&gt;<br>&lt;dict&gt;<br>    &lt;key&gt;CFBundleAlternateIcons&lt;/key&gt;<br>    &lt;dict&gt;<br>        &lt;!-- icon&#39;s directory --&gt;<br>        &lt;key&gt;MyCustomIcon&lt;/key&gt;<br>        &lt;dict&gt;<br>            &lt;key&gt;CFBundleIconFiles&lt;/key&gt;<br>            &lt;array&gt;<br>            &lt;!-- filename minus extension and size info --&gt;<br>                &lt;string&gt;MyCustomIcon&lt;/string&gt;<br>                &lt;string&gt;MyCustomIcon-83.5@2x&lt;/string&gt;<br>                &lt;string&gt;MyCustomIcon-76@2x&lt;/string&gt;<br>            &lt;/array&gt;<br>        &lt;/dict&gt;<br>        &lt;!-- icon&#39;s directory --&gt;<br>        &lt;key&gt;MyCustomIcon-green&lt;/key&gt;<br>        &lt;dict&gt;<br>            &lt;key&gt;CFBundleIconFiles&lt;/key&gt;<br>            &lt;array&gt;<br>            &lt;!-- filename minus extension and size info --&gt;<br>                &lt;string&gt;MyCustomIcon-green&lt;/string&gt;<br>                &lt;string&gt;MyCustomIcon-green-83.5@2x&lt;/string&gt;<br>                &lt;string&gt;MyCustomIcon-green-76@2x&lt;/string&gt;<br>            &lt;/array&gt;<br>        &lt;/dict&gt;<br>    &lt;/dict&gt;<br>    &lt;key&gt;CFBundlePrimaryIcon&lt;/key&gt;<br>    &lt;dict&gt;<br>        &lt;key&gt;CFBundleIconFiles&lt;/key&gt;<br>        &lt;array&gt;<br>            &lt;string&gt;&lt;/string&gt;<br>        &lt;/array&gt;<br>        &lt;key&gt;CFBundleIconName&lt;/key&gt;<br>        &lt;string&gt;&lt;/string&gt;<br>        &lt;key&gt;UIPrerenderedIcon&lt;/key&gt;<br>        &lt;false/&gt;<br>    &lt;/dict&gt;<br>&lt;/dict&gt;</pre><ol><li>Don’t forget to add these to the project repository, but not the App icon sets. (It’s a different approach — you can follow SwiftLee’s documentation for the recommended way — <a href="https://www.avanderlee.com/swift/alternate-app-icon-configuration-in-xcode/">alternate app icon configuration in xcode</a>).</li><li>Make sure these new icons are properly added to the correct target membership.</li><li>Verify if these are included in the Copy bundle resource in the target that you are working on.</li></ol><p><em>Connect with me on @</em><a href="https://www.linkedin.com/in/mythraiboga/"><em>LinkedIn</em></a><em> to discuss and debug these warnings together. Let’s improve together, one step at a time.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0625fbfc5d68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wanna be a good Interviewer? Here is a Simple Guide for Better Interview Conversations]]></title>
            <link>https://medium.com/@bogamythrai/mastering-interview-etiquette-as-an-interviewer-a-simple-guide-for-better-conversations-52745aa0fcb9?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/52745aa0fcb9</guid>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 15:04:45 GMT</pubDate>
            <atom:updated>2025-11-26T13:23:16.019Z</atom:updated>
            <content:encoded><![CDATA[<p>Interviews don’t have to feel like an interrogation. They can be easy, clear, and even enjoyable when both sides know what to expect. As interviewers, a few small habits can completely change how comfortable and confident a candidate feels — and that often leads to a much better conversation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*ZDSH8W8LHF48ftBKLf9hnA.png" /></figure><p>Here are some simple, practical etiquette tips I follow to keep interviews smooth, fair, and respectful.</p><h4>Start With a Clear Brief</h4><p>Always begin the interview by <strong>explaining what the round is about</strong>.<br> This helps the candidate understand what to expect and mentally prepare for the flow</p><p>📌 <em>Example Brief:</em><br> “This round focuses on your technical understanding, problem-solving approach, and familiarity with real-world scenarios. I’ll be asking a mix of conceptual and practical questions.”</p><p>A clear introduction sets the tone and reduces anxiety.</p><h4>Outline the Categories You’ll Cover</h4><p>Be transparent about the <strong>types of topics</strong> you’ll touch on.</p><p>Mention the broad areas you’ll touch on (concepts, problem-solving, scenarios, architecture, etc.).<br>No deep explanation needed — just enough for them to understand the direction.</p><h4>Let Them Know You’ll Take Notes</h4><p>If you’ll be writing feedback during the conversation, say it upfront.<br> A simple line like:<br> 📝 <em>“I’ll be taking notes, so if I look aside, I’m still listening.”</em><br> This avoids misunderstandings and keeps the flow natural.</p><h4>Encourage Openness</h4><p>Tell the candidate they can stop you anytime if they want something repeated or clarified.<br>This makes the interview feel more like a conversation and less like a test.</p><h4>Check Time Constraints Early</h4><p>Ask if they have any hard stop and whether a small extension is okay if needed.<br>This avoids last-minute rushing and helps you manage pacing better.</p><h4>If They Get Stuck, Gently Guide</h4><p>A small hint can help them move forward.<br>If they’re still stuck, keep a quick time check and move on politely.<br>The goal isn’t perfection — it’s understanding how they think.</p><h4>Keep 5 Minutes for Their Questions</h4><p>Always end with space for the candidate to ask anything about the role, team, or company.<br>This is their chance to evaluate you too — respect it.</p><h3>Summary</h3><p>Hi, before we begin, I’ll give a quick overview of the round.</p><ol><li>This round focuses on your technical understanding, problem-solving approach, and real-world application of concepts.</li><li>We’ll be covering a few key areas: core concepts, practical questions, scenario-based discussions, and architecture-level thinking.</li><li>I’ll be taking some notes during our conversation. If you see me looking aside, I’m still fully listening — just documenting feedback.</li><li>If anything isn’t clear, feel free to stop me anytime. I’m happy to repeat, clarify, or re-explain anything.</li><li>Before we start, do you have any hard stop? If needed, can we extend a few minutes beyond the scheduled time?</li><li>Towards the end, I’ll reserve about 5 minutes for you to ask any questions about the role, team, or process.</li></ol><h3>🎯 Conclusion: Great Interviews Are Designed, Not Just Conducted</h3><p>A great interview doesn’t come from difficult questions — it comes from <strong>creating clarity, comfort, and fairness</strong>. These small etiquette habits make candidates feel comfortable, help you evaluate better, and create a positive experience on both sides.</p><p><strong>✨ People may forget the questions you asked, but they’ll remember how you made them feel. Give them a conversation worth remembering.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52745aa0fcb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI .id() Explained: Control View Updates and State]]></title>
            <link>https://medium.com/@bogamythrai/swiftui-id-explained-control-view-updates-and-state-80428635bc7c?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/80428635bc7c</guid>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Sat, 24 May 2025 10:54:57 GMT</pubDate>
            <atom:updated>2025-05-24T10:59:09.821Z</atom:updated>
            <content:encoded><![CDATA[<h3>SwiftUI .id() Explained: Control View Updates and State</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGYmU-BizGOzoJGNFjGllg.png" /></figure><p>SwiftUI is smart — it uses <strong>structural identity</strong> to decide whether to update, reuse, or destroy views. But sometimes, this default behavior gets it wrong. That’s when .id() becomes your friend.</p><h3>⚠️ The Problem</h3><p>When SwiftUI <strong>misidentifies</strong> a view:</p><ul><li>UI <strong>doesn’t update</strong> properly</li><li><strong>Animations behave</strong> weirdly</li><li><strong>State gets retained</strong> in the wrong place</li></ul><p>Why? Because SwiftUI thinks it’s still the <em>same view</em>.</p><h3>🧪 Solution</h3><p>You can <strong>forcefully assign a new identity</strong> to any view using .id().</p><pre>Text(&quot;Hello&quot;)<br> .id(&quot;greeting-v1&quot;) // New identity for the view</pre><p>Whenever the .id() value changes, SwiftUI treats it as a new view and re-renders it without trying to diff with the old one.</p><h3>Example: Bug Without .id()</h3><pre>struct ContentView: View {<br>    @State private var showA = true<br><br>    var body: some View {<br>        VStack {<br>            Button(&quot;Toggle&quot;) {<br>                showA.toggle()<br>            }<br><br>            if showA {<br>                CustomView(title: &quot;View A&quot;)<br>            } else {<br>                CustomView(title: &quot;View B&quot;)<br>            }<br>        }<br>    }<br>}<br><br>struct CustomView: View {<br>    let title: String<br>    @State private var count = 0<br><br>    var body: some View {<br>        VStack {<br>            Text(title)<br>            Button(&quot;Tap count: \(count)&quot;) {<br>                count += 1<br>            }<br>        }<br>    }<br>}</pre><h3>❗Issue:</h3><ul><li>CustomView <strong>doesn’t reset the counter</strong> when switching from A → B</li><li>SwiftUI reuses the same view because it <strong>thinks it’s structurally identical</strong></li></ul><h3>✅ Fix Using .id()</h3><pre>if showA {<br>    CustomView(title: &quot;View A&quot;)<br>        .id(&quot;A&quot;)<br>} else {<br>    CustomView(title: &quot;View B&quot;)<br>        .id(&quot;B&quot;)<br>}</pre><p>Now SwiftUI understands:</p><ul><li>These are <strong>two different identities</strong></li><li>It will <strong>reset </strong><strong>@State</strong>, animations, etc.</li></ul><h3>🎯 Benefits</h3><blockquote>It’s especially useful when toggling between <strong>stateful views that look similar</strong></blockquote><ul><li>Fixes <strong>UI glitches</strong> caused by incorrect view reuse</li><li>Ensures <strong>correct animations and transitions</strong></li><li>Resets <strong>state</strong> cleanly when needed</li><li>Helps with <strong>dynamic view switching</strong> or conditional rendering</li></ul><h3>💡 Real-World Use Cases for .id()</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_YptvNg1X-5JZ3uW8WgiTw.png" /></figure><h3>🏁 Final Thought</h3><p>Think of .id() as a <strong>manual override</strong> for SwiftUI’s brain. Use it sparingly, but powerfully, when SwiftUI gets view identity wrong.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80428635bc7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI EquatableView]]></title>
            <link>https://medium.com/@bogamythrai/swiftui-equatableview-0158873cdc70?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/0158873cdc70</guid>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Sat, 24 May 2025 10:10:33 GMT</pubDate>
            <atom:updated>2025-05-24T10:10:53.827Z</atom:updated>
            <content:encoded><![CDATA[<h3>When Your View Doesn’t Need to Rebuild Every Time</h3><p>While optimizing a screen in one of my SwiftUI projects, I noticed that some subviews were <strong>redrawing unnecessarily</strong> on every parent state change, — even if their own data hadn’t changed.</p><p>To solve that, I used <strong>EquatableView</strong>, which tells SwiftUI to <strong>only re-render when the view’s properties changes</strong>.</p><h3>What is EquatableView?</h3><p>SwiftUI normally redraws child views when the parent updates, even if the child doesn’t need to. EquatableView lets you prevent that — <strong>as long as the child’s properties conform to </strong><strong>Equatable</strong>.</p><p>📌 Example</p><pre>struct ParentView: View {<br>    @State private var counter = 0<br><br>    var body: some View {<br>        VStack(spacing: 20) {<br>            Button(&quot;Add player&quot;) {<br>                counter += 1<br>            }<br><br>            // This only updates when `count` changes inside CricketTeamsView<br>            EquatableView(content: CricketTeamsView(count: counter))<br>        }<br>    }<br>}<br><br>struct CricketTeamsView: View, Equatable {<br>    let count: Int<br>    private var personsPerTeam = 11<br><br>    var body: some View {<br>        print(&quot;Rendering CricketTeamsView with count: \(count)&quot;)<br>        return Text(&quot;Total teams count: \(count % personsPerTeam)&quot;)<br>    }<br><br>    static func == (lhs: Self, rhs: Self) -&gt; Bool {<br>        // Only re-render when count is three<br>        lhs.count % personsPerTeam == 0 &amp;&amp; rhs.count % personsPerTeam == 0 &amp;&amp; lhs.count == rhs.count<br>    }<br>}</pre><p>Here CricketTeamsView doesn’t re-render just because ParentView updates — it only updates when the count is a multiplier of 11 changes.</p><h3>🔍 When Should You Use It?</h3><p>Use EquatableView when:</p><ul><li>A subview receives the same input most of the time</li><li>Your parent state changes frequently</li><li>The view body is complex or has a performance cost</li></ul><h3>🎯 Key Takeaway</h3><p>EquatableView is a <strong>great performance tool</strong> in SwiftUI when:</p><ul><li>There are <strong>frequent state updates</strong> in the parent</li><li>Your subview is <strong>complex and mostly stable</strong></li><li>You want <strong>fine-grained control over rendering</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0158873cdc70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing for Everyone: Accessibility Learnings in SwiftUI]]></title>
            <link>https://medium.com/@bogamythrai/designing-for-everyone-accessibility-learnings-in-swiftui-1a09d040d1ba?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a09d040d1ba</guid>
            <category><![CDATA[appledeveloper]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[iosdevelopement]]></category>
            <category><![CDATA[inclusive-design]]></category>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Sat, 17 May 2025 07:33:19 GMT</pubDate>
            <atom:updated>2025-05-17T07:33:19.860Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>— from Apple Developer Center Session Bangalore</em></h4><p>The session was a great reminder that <strong>building for accessibility isn’t just a feature — it’s a responsibility</strong>.</p><p>As developers, we often think about performance, animations, or UI polish, but how often do we ask ourselves: <em>Can </em><strong><em>everyone</em></strong><em> actually use this app?</em></p><p>Here are the biggest takeaways from the session that I think every developer should reflect on:</p><h4>🔊 VoiceOver</h4><p>We explored how VoiceOver users interact with the app using gestures and screen reading. The importance of proper accessibility labels, hints, and ordering cannot be overstated. Every UI element should communicate purposefully to VoiceOver users.</p><p><strong>Tip</strong>: Don’t just label buttons — add context using .accessibilityHint and .accessibilityValue to guide user interactions.</p><pre>Button(action: {<br>    print(&quot;Order placed&quot;)<br>}) {<br>    Text(&quot;Place Order&quot;)<br>        .padding()<br>        .background(Color.green)<br>        .foregroundColor(.white)<br>        .cornerRadius(10)<br>}<br>.accessibilityLabel(&quot;Place Order&quot;)<br>.accessibilityHint(&quot;Double tap to confirm the order&quot;)<br>.accessibilityAddTraits(.isButton)</pre><h4>🔡 Dynamic Type</h4><p>Supporting Dynamic Type is no longer optional. The session emphasized using semantic text styles like .title, .body, etc., and avoiding hardcoded font sizes. This ensures text adjusts based on the user’s accessibility settings.</p><pre>Text(&quot;Welcome to our app&quot;)<br>    .font(.title) // Uses a Dynamic Type-compatible style<br>    .padding()<br>    .multilineTextAlignment(.center)</pre><blockquote><em>✅ Avoid </em><em>.font(.system(size: 20))—use </em><em>.title, </em><em>.body, etc., so it scales with user settings.</em></blockquote><h4>🧠 Assistive Access</h4><p>A newer feature designed for users with cognitive challenges. It simplifies UI layouts and interactions — allowing us to tailor experiences for greater clarity and focus.</p><h4>🎵 Music Haptics</h4><p>A brilliant addition: haptics synchronized to audio playback — especially helpful for deaf and hard-of-hearing users. It’s a powerful example of Apple pushing sensory inclusivity forward.</p><h4>🔧 Accessibility Modifiers in SwiftUI</h4><p>This was a favorite part of the session! SwiftUI’s accessibility modifiers like .accessibilityLabel(), .accessibilityHint(), .accessibilitySortPriority() make it incredibly easy to enhance UI accessibility. Even better, these modifiers stack beautifully, making your views much more expressive and usable.</p><pre>Image(systemName: &quot;star.fill&quot;)<br>    .foregroundColor(.yellow)<br>    .accessibilityLabel(&quot;Favorite&quot;)<br>    .accessibilityHint(&quot;Marks this item as your favorite&quot;)</pre><h3>Final Thoughts</h3><blockquote><em>“Accessibility is not an add-on. It’s baked into good design.”</em></blockquote><p>I walked away from the session not just with technical knowledge but with a mindset shift. As developers, we have the tools — and the responsibility — to build for <strong>everyone</strong>.</p><p><strong>Where to start from here 👇</strong></p><ul><li><a href="https://developer.apple.com/accessibility/">Apple Accessibility Guide</a></li><li><a href="https://developer.apple.com/videos/framework/accessibility/">Accessibility Sessions from WWDC</a></li></ul><p>Thanks for reading! Feel free to share your thoughts or tips on accessibility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a09d040d1ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift DispatchQueue Deadlock Trap]]></title>
            <link>https://medium.com/@bogamythrai/swift-dispatchqueue-deadlock-trap-32556f63786f?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/32556f63786f</guid>
            <category><![CDATA[iosdev]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[gcd]]></category>
            <category><![CDATA[deadlock]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 14:13:07 GMT</pubDate>
            <atom:updated>2025-04-16T15:41:22.240Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Swift Pro Tip:</strong> Avoid This Common DispatchQueue Deadlock Trap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4aX7S4Zcv7Dx_bUI8tLxGw.png" /></figure><p><em>While we’re gradually adopting Swift Concurrency, </em><em>DispatchQueue remains widely used across our projects. Lets dive in solving the trap…</em></p><p>Working with DispatchQueue in Swift is powerful — but with that power comes the risk of <strong>deadlocks </strong>if you are not careful. These issues are hard to debug and reproduce in code.</p><p>After several trails and research, I found one tip that can save hours of debugging time and maybe even an embarrassing crash in production)</p><h3>🧠 The Golden Rule</h3><blockquote><strong><em>Never call a </em></strong><strong><em>sync block inside an </em></strong><strong><em>async block on the same SERIAL queue.</em></strong></blockquote><blockquote><em>Doing so will lead to a deadlock.</em></blockquote><p>This is classic concurrency pitfall 😪 that catches most of the developers off-guard.</p><h3>🔍 Understanding the Problem</h3><p>Imagine you’re inside an async block on a <strong>serial queue</strong>, and within that block, you call sync—<strong>on the same queue</strong>.</p><p>You’re now asking the queue to:</p><ul><li>Wait for the sync block to finish…</li><li>While already running the outer async block…</li></ul><p>Which can’t happen, because the queue only runs <strong>one block at a time</strong>. That’s a <strong>deadlock</strong>.</p><h3><strong>✅ Safe vs ❌ Unsafe Scenarios</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdIrISONLsXU2m2J6COAWw.png" /></figure><h3>❌ Dangerous Pattern (Deadlock)</h3><pre>let serialQueue = DispatchQueue(label: &quot;com.example.serial&quot;)<br><br>serialQueue.async {<br>    // This is running on serialQueue<br>    // Deadlock: sync on same serial queue from async block<br>    serialQueue.sync {<br>        print(&quot;Inner block&quot;)<br>    }<br>}</pre><h3>✅ Safe Patterns: Use a Different Queue</h3><pre>// Example 1<br>serialQueue.async {<br>    // Safe: sync on a different queue<br>    DispatchQueue.global().sync {<br>        print(&quot;This is safe&quot;)<br>    }<br>}</pre><pre>// Example 2<br>let concurrentQueue = DispatchQueue(label: &quot;com.example.concurrent&quot;, attributes: .concurrent)<br><br>concurrentQueue.async {<br>    // Safe: concurrent queue allows re-entry<br>    concurrentQueue.sync {<br>        print(&quot;Still safe&quot;)<br>    }<br>}</pre><h3>🔐 Rule of Thumb</h3><blockquote><strong><em>Avoid calling </em></strong><strong><em>sync on the same serial queue from within its own </em></strong><strong><em>async block.</em></strong></blockquote><p>Stick to this rule and you’ll rock 🚀 on the most common causes of deadlocks in GCD.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32556f63786f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Struct vs Class Memory Behavior in Swift]]></title>
            <link>https://medium.com/@bogamythrai/understanding-struct-vs-class-memory-behavior-in-swift-a-practical-guide-82ceb2d6b7cb?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/82ceb2d6b7cb</guid>
            <category><![CDATA[class]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[struct]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Mon, 07 Apr 2025 17:26:47 GMT</pubDate>
            <atom:updated>2025-04-08T03:51:55.731Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Understanding Struct vs Class Memory Behavior in Swift</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5YJp2Bm809qVmIHLFldc2w.jpeg" /></figure><p>When working with Swift, understanding the difference in memory behavior between structs and classes can help you write more predictable, performant, and bug-free code. In this post, I’ll walk through how structs and classes behave when passed to functions, and why their memory addresses change (or don’t).</p><h3>Structs are Value Types</h3><p>Let’s start with structs. Structs in Swift are <strong>value types</strong>, which means they are <strong>copied</strong> when passed into functions or assigned to another variable.</p><pre>struct UserStruct {<br>    var name: String<br>}<br><br>func printStructAddress(_ user: UserStruct) {<br>    withUnsafePointer(to: user) {<br>        print(&quot;Struct address inside function: \($0)&quot;)<br>    }<br>}<br><br>var userStruct = UserStruct(name: &quot;Bob&quot;)<br><br>withUnsafePointer(to: userStruct) {<br>    print(&quot;Struct address before function: \($0)&quot;)<br>}<br><br>printStructAddress(userStruct)</pre><p><strong>Output:</strong></p><pre>Struct address before function: 0x600001234560<br>Struct address inside function: 0x600001234580</pre><p>Even though the value is the same, Swift made a <strong>copy</strong> when passing it to printStructAddress function — so the address is different.</p><h3>Inout Parameters Avoid Copying</h3><p>To avoid this copy, you can use an inout parameter:</p><pre>func printInoutStructAddress(_ user: inout UserStruct) {<br>    withUnsafePointer(to: user) {<br>        print(&quot;Struct address with inout: \($0)&quot;)<br>    }<br>}<br><br>withUnsafePointer(to: userStruct) {<br>    print(&quot;Struct address before inout function: \($0)&quot;)<br>}<br><br>printInoutStructAddress(&amp;userStruct)</pre><p><strong>Output:</strong></p><pre>Struct address before inout function: 0x600001234560<br>Struct address with inout: 0x600001234560</pre><p>Using inout passes a <strong>reference</strong> to the original struct, preserving the memory address.</p><h3>Classes are Reference Types</h3><p>Now, let’s look at classes:</p><pre>class UserClass {<br>    var name: String<br>    init(name: String) { self.name = name }<br>}<br><br>func printClassAddress(_ user: UserClass) {<br>    withUnsafePointer(to: user) {<br>        print(&quot;Class reference address: \($0)&quot;)<br>    }<br>    let unmanaged = Unmanaged.passUnretained(user)<br>    print(&quot;Instance memory address: \(unmanaged.toOpaque())&quot;)<br>}<br><br>let userClass = UserClass(name: &quot;Alice&quot;)<br><br>withUnsafePointer(to: userClass) {<br>    print(&quot;Class reference address before function: \($0)&quot;)<br>}<br><br>let unmanaged = Unmanaged.passUnretained(userClass)<br><br>print(&quot;Instance memory address before function: \(unmanaged.toOpaque())&quot;)<br><br>printClassAddress(userClass)</pre><p><strong>Output:</strong></p><pre>Class reference address before function: 0x600001200000<br>Instance memory address before function: 0x100608ea0<br>Class reference address: 0x600001200020<br>Instance memory address: 0x100608ea0</pre><p>✅ <strong>Same instance</strong>, ❌ <strong>Different reference variable</strong>.</p><p>Even though the reference address changes (because it’s a new pointer variable on the stack), the <strong>instance memory address remains the same</strong>. That’s because classes are <strong>reference types</strong>, and Swift only copies the pointer to the heap-allocated instance.</p><h3>Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZHZdJHlx2jZsGwfXhkecw.png" /></figure><h3>Real-World Analogy</h3><ul><li><strong>Struct</strong>: Like photocopying a document and giving someone the copy.</li><li><strong>Class</strong>: Like handing someone the same book you’re reading.</li></ul><h3>Final Thoughts</h3><p>Understanding how Swift handles memory for structs and classes helps you reason better about performance and side effects. If you’re handling state-sensitive data, or optimizing performance, knowing when you’re working with a copy or a reference is critical.</p><p>Play with the examples in a Swift playground and watch the memory behavior live.</p><p>If you have suggestions or find errors in my logic, please comment below. I’d love to hear and learn from you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82ceb2d6b7cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Affect of @inline(__always) and @inline(never) on App size reduction and performance]]></title>
            <link>https://medium.com/@bogamythrai/affect-of-inline-always-and-inline-never-on-app-size-reduction-and-performance-b29e6c7e3fa6?source=rss-e4d2fc0ebdc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b29e6c7e3fa6</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[app-size-reduce]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[app-size]]></category>
            <dc:creator><![CDATA[Bogamythrai]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 14:13:34 GMT</pubDate>
            <atom:updated>2025-03-14T14:13:34.337Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DY9gCRsTfvn-U9HNiqohLA.jpeg" /></figure><p><em>ChatGPT helped me write this blog</em></p><p>Recently, I was working on reducing the iOS app binary size, which was a key priority of our team. While optimizing, I noticed that certain function calls affected performance and code size. This led me to explore Swift’s function inlining attributes: @inline(__always) and @inline(never). By strategically using these, I was able to strike the right balance between speed and efficiency.</p><h3>The Challenge: Balancing Performance and App Size</h3><p>Our app had grown significantly, and we were hitting size limitations that affected both download speed and startup performance. One of the culprits was the excessive inlining of functions, which led to code bloat. At the same time, certain performance-critical functions were not being inlined when they should have been, adding unnecessary function call overhead.</p><h3>What is Function Inlining?</h3><p>Function inlining is an optimization technique where the compiler replaces a function call with its actual body. While this eliminates function call overhead, excessive inlining can lead to a larger binary. Swift’s compiler makes these decisions automatically, but using @inline(__always) and @inline(never), I could fine-tune this behavior.</p><h3>How I Used @inline(__always)</h3><p>The @inline(__always) attribute forces the compiler to inline a function’s body at every call site. I used this for small, frequently called utility functions that were adding unnecessary function call overhead.</p><h3>Example in My Optimization</h3><pre>@inline(__always)<br>func fastMultiply(_ a: Int, _ b: Int) -&gt; Int {<br>    return a * b<br>}<br><br>func test() {<br>    let result = fastMultiply(4, 5) // This will be replaced by `let result = 4 * 5`<br>}</pre><p>In our performance tests, using @inline(__always) for simple mathematical operations inside tight loops reduced execution time without significantly increasing binary size.</p><h3>Lessons Learned</h3><ul><li><strong>Best for small functions</strong> — Works well when the function is simple and frequently used.</li><li><strong>Avoid overuse</strong> — Excessive inlining led to binary growth, which negated the size savings.</li></ul><h3>How I Used @inline(never)</h3><p>On the other hand, the @inline(never) attribute prevents the compiler from inlining a function, ensuring that every call remains a distinct function call. I applied this to large functions that were needlessly getting inlined, bloating the binary.</p><h3>Example in My Optimization</h3><pre>@inline(never)<br>func complexComputation(_ x: Int) -&gt; Int {<br>    return (x * x) + (x / 2) - 3<br>}<br><br>func test() {<br>    let result = complexComputation(10) // This function call will NOT be inlined.<br>}</pre><p>By marking large functions as @inline(never), I saw a noticeable reduction in app size, as the compiler stopped replicating function bodies across different call sites.</p><h3>Lessons Learned</h3><ul><li><strong>Best for large functions</strong> — Avoids unnecessary code duplication.</li><li><strong>Improves debugging</strong> — Helps retain clear function call stacks for profiling.</li></ul><h3>The Result: A Leaner, Faster App</h3><p>By carefully applying @inline(__always) and @inline(never), I managed to achieve:</p><ul><li><strong>A smaller binary size</strong> without sacrificing performance.</li><li><strong>Faster execution times</strong> by inlining critical functions.</li><li><strong>Easier debugging and profiling</strong> by preventing unnecessary inlining.</li></ul><h3>Conclusion</h3><p><strong>When to Use </strong><strong>@inline(__always)</strong></p><ul><li>For small, frequently used functions where function call overhead is a concern.</li><li>When optimizing tight loops to reduce execution time.</li><li>When function size is minimal and inlining won’t cause code bloat.</li></ul><p><strong>When to Use </strong><strong>@inline(never)</strong></p><ul><li>For large functions that should not be duplicated across multiple call sites.</li><li>When reducing binary size is a priority.</li><li>When preserving function call stacks for debugging and profiling.</li></ul><h3>Final Thoughts</h3><p>This experience reinforced that optimization isn’t just about making code faster — it’s about making the right trade-offs. Function inlining is a powerful tool, but using it wisely requires a good understanding of your app’s performance characteristics. By profiling and testing different inlining strategies, I was able to make meaningful improvements without unnecessary bloat.</p><p>If you’re facing similar challenges with app size and performance, give these attributes a try — but always measure the impact before making changes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b29e6c7e3fa6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>