<?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 Leela on Medium]]></title>
        <description><![CDATA[Stories by Leela on Medium]]></description>
        <link>https://medium.com/@leelajyothiramala?source=rss-5acc4951e07d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eqccrL9lyCgFmYwG1om8hQ.jpeg</url>
            <title>Stories by Leela on Medium</title>
            <link>https://medium.com/@leelajyothiramala?source=rss-5acc4951e07d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 17:40:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@leelajyothiramala/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[Custom SwiftUI Charts]]></title>
            <link>https://medium.com/@leelajyothiramala/custom-swiftui-charts-a94fcf7afe8a?source=rss-5acc4951e07d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a94fcf7afe8a</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[iosdev]]></category>
            <dc:creator><![CDATA[Leela]]></dc:creator>
            <pubDate>Thu, 17 Aug 2023 13:18:56 GMT</pubDate>
            <atom:updated>2023-08-17T13:18:56.080Z</atom:updated>
            <content:encoded><![CDATA[<p>SwiftUI Charts framework has many capabilities which allows to get charts appear in UI with less code. There are many great tutorials out there to learn about Charts frameowrk.</p><p>In this article, I wanted to explain about particular customisation to bar chart that would allow user to compare current data with predicted future data. Suppose we wanted to show user what is average time it takes to reach one place to another place at current hour by highlighting it. (shown in picture)</p><p>To learn about BarCharts please refer <a href="https://developer.apple.com/documentation/charts/creating-a-chart-using-swift-charts">https://developer.apple.com/documentation/charts/creating-a-chart-using-swift-charts</a></p><figure><img alt="X-axis : Time with half hour intervals, Y-axis: Time taken at that hour. Highlighted Bar value compares real data with predicted data at the current hour." src="https://cdn-images-1.medium.com/max/750/1*1jK10Nro2OSQadNg0eIiNA.png" /></figure><p>To achieve this we need to tweak model data which is supplied to BarChart to draw like below.</p><pre> static let barData = [<br>       BarData(duration: 2, time: &quot;0930&quot;),<br>       BarData(duration: 9, time: &quot;1000&quot;, averageDuration: 5),<br>       BarData(duration: 5, time: &quot;1030&quot;),<br>       BarData(duration: 8, time: &quot;1100&quot;),<br>       BarData(duration: 9, time: &quot;1130&quot;),<br>       BarData(duration: 6, time: &quot;1200&quot;),<br>       BarData(duration: 7, time: &quot;1230&quot;),<br>       BarData(duration: 8, time: &quot;1300&quot;)<br>    ]</pre><p>The above is my model to construct bar chart.</p><pre>Chart (TaxiTimesData.barData) { data in<br>            <br>            if data.duration &gt;= data.averageDuration { // 1<br>                BarMark(<br>                    x: .value(&quot;Time&quot;, data.time),<br>                    y: .value(&quot;Duration&quot;, data.duration),<br>                    width: 32.0<br>                )<br>                .cornerRadius(4.0)<br>                .foregroundStyle(Color.gray)<br>            }<br>            <br>            if data.averageDuration &gt; 0 { // 2.<br>                BarMark(<br>                    x: .value(&quot;Time&quot;, data.taxiData),<br>                    y: .value(&quot;Duration&quot;,  data.averageDuration),<br>                    width: 32.0<br>                )<br>                .cornerRadius(4.0)<br>                .position(by: .value(&quot;Duration&quot;,  data.averageDuration))<br>                .foregroundStyle(Color.red)<br>                <br>                if data.duration &lt; data.averageDuration { //3. <br>                    BarMark(<br>                        x: .value(&quot;Time&quot;, data.taxiData),<br>                        y: .value(&quot;Duration&quot;, data.duration),<br>                        width: 32.0<br>                    )<br>                    .cornerRadius(4.0)<br>                    .foregroundStyle(Color.gray)<br>                }<br>            }<br>        }</pre><ol><li>In first if condition we are trying to draw bar mark for all the values for which duration is greater than average duration such that we show grey bar mark below the redBar mark.</li><li>In second step, if model data.averageDuration is greater than 0 (that means we are setting averageDuration value to 0 default in model), then draw the BarMark by using <strong>position</strong> modifier (It is used to create grouped bar chart) which is redColor</li><li>In third condition, we need to handle scenario where duration is less than average duration in such case we need gray Bar Mark on top of red Bar Mark.</li></ol><p>The above steps would create custom bar chart as shown above.</p><p>For complete code, checkout below link: <a href="https://github.com/LeelaRamala/CustomBarChart_SwiftUI_Charts">https://github.com/LeelaRamala/CustomBarChart_SwiftUI_Charts</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a94fcf7afe8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS Debugging Tip]]></title>
            <link>https://medium.com/@leelajyothiramala/ios-debugging-tip-9aed164793c7?source=rss-5acc4951e07d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aed164793c7</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ipad-os]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Leela]]></dc:creator>
            <pubDate>Tue, 11 Apr 2023 16:21:49 GMT</pubDate>
            <atom:updated>2023-04-11T16:21:49.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pry7-eFlZxWJhr7Fm7rYA.jpeg" /></figure><p>There are times we may come across scenario like any change we do in the class object we might not see in UI. This may be the issue when you have two objects of same type and you are using one to display in UI and other is created but not used or created but not demolished.</p><p>In such cases we have a hearty helper which is “Debug memory graph” in XCode. Which shows how many objects are present in each class.</p><p>It says… I’m here for your help!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpHPAXkTuCH4mckWgSSk3A.png" /><figcaption>Xcode, bottom bar</figcaption></figure><p>This shows objects list with count like below and a graph which depicts who is holding those objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*Vb07MqA1lyxKzCawYV53dQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*bg9k4zAFSl8WuTFtsrDasQ.png" /></figure><p>This not only helps us to debug this, this also can be used in following scenarios.</p><ul><li>When you have memory spike in app</li><li>When you have crash due to retain cycle</li></ul><p>Additional Tip: It’s always best practise : when you add new class always check that class object is discarded when it’s not needed.</p><p>For example, when you logout from the app all the viewcontrollers and all other objects should be deallocated. Only Objects which are related to login and classes which required must present in memory.</p><p>For more details on this please check: <a href="https://developer.apple.com/documentation/xcode/gathering-information-about-memory-use">https://developer.apple.com/documentation/xcode/gathering-information-about-memory-use</a></p><p>I hope you enjoyed this article. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aed164793c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift UI Tip #2]]></title>
            <link>https://medium.com/@leelajyothiramala/swift-ui-tip-2-15343130a5ff?source=rss-5acc4951e07d------2</link>
            <guid isPermaLink="false">https://medium.com/p/15343130a5ff</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift-programming]]></category>
            <dc:creator><![CDATA[Leela]]></dc:creator>
            <pubDate>Mon, 08 Aug 2022 09:26:39 GMT</pubDate>
            <atom:updated>2022-08-08T09:26:39.821Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift UI Tip #2</p><p>Swift UI has one of the finest UI element called Label which would allow us to have image and label shown in UI respectively (as below).</p><pre>Label(“\(recipe.minTime ?? “ — “) / \(recipe.maxTime, systemImage: “chevron.right”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*blOJ9iImooqSEMbe_r0xbA.png" /><figcaption>Label at left side of row with image and text shown respectively</figcaption></figure><p>However we wanted the chevron image to be shown next to text, however Label doesn’t have that configuration style by default.</p><p>We can do this by creating custom label style as below.</p><pre><strong>struct</strong> AccessibilityStyle: LabelStyle {</pre><pre><strong>  private</strong> <strong>let</strong> color: Color</pre><pre><strong>     init</strong>(iconColor: Color = .black) {</pre><pre><strong>          self</strong>.color = iconColor</pre><pre>      }</pre><pre>  @ViewBuilder</pre><pre><strong>     func</strong> makeBody(configuration: Configuration) -&gt; <strong>some</strong> View {</pre><pre>          HStack {</pre><pre>            configuration.title</pre><pre>             configuration.icon.foregroundColor(color)</pre><pre>           }</pre><pre>     } <br>}</pre><p>Use the above style by applying modifier <strong>.labelStyle. </strong>We can use this modifier for all the different configurations you want in different screen widths etc..</p><pre>Label(“\(runwayModel.taxiIn ?? “ — “) / \(runwayModel.taxiOut ?? “ — “)”, systemImage: “chevron.right”)</pre><pre> .labelStyle(AccessibilityStyle(iconColor: .blue))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*Z46lGsrEBaColXqtY5y6Mg.png" /></figure><p>P.S. We are using color as parameter to above struct because by default when applying this style chevron would be black in color.</p><p>Thank you. Comments / Suggestions are welocme.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15343130a5ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift UI Tips]]></title>
            <link>https://medium.com/@leelajyothiramala/swift-ui-tips-8940bf93bff6?source=rss-5acc4951e07d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8940bf93bff6</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Leela]]></dc:creator>
            <pubDate>Tue, 26 Jul 2022 10:33:09 GMT</pubDate>
            <atom:updated>2022-08-08T09:31:28.321Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is to post Swift UI tips in simple words and images</p><p>Swift UI Tip #1</p><p>Difference between .position and .offset modifier of View is as depicted below.</p><p><strong>Position</strong> Modifier would place view with respect to parent coordinates</p><p><strong>Offset</strong> Modifier would place view with respect to its own bounds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*7TK5TrjVMdU6HxRmQ5C-qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*tpZU2o8cENXMrCPF47wAwg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8940bf93bff6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamically sized button with UIStackView]]></title>
            <link>https://medium.com/@leelajyothiramala/dynamically-sized-button-with-uistacview-9224db506e46?source=rss-5acc4951e07d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9224db506e46</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[uistackview]]></category>
            <dc:creator><![CDATA[Leela]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 16:19:12 GMT</pubDate>
            <atom:updated>2018-09-27T10:59:15.559Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Problem</strong>: We would have come across a situation where we want to show two buttons placed horizontally by having equal width in a view like below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*EI2nUAWpzamxFqBAZ0hV-g.png" /></figure><p>In some cases, we may need to hide one of the buttons and show the button center to the view like below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*inTBi1-88Dwua-Rg11Z3uA.png" /></figure><p>We know this is quiet common scenario and we could achieve by using constraints. However, by using constraints we end up with adding many constraints to view and altering them when we need to hide one button.</p><p>We can do this easily without dealing with constraints, by using stack views.</p><p>When we use stack views and when we need to hide one of the button we end up having button stretched (in horizontal stack view with fill alignment). To avoid this we need to change StackView axis, alignment, distribution appropriately like below code snippet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NY7bzvRkIziJbgqzUHEm0A.png" /></figure><p>Here, we are modifying stack view <strong>axis</strong> to <strong>vertical</strong> with <strong>alignment</strong> as <strong>center</strong> and <strong>distribution</strong> as <strong>fillProportionally </strong>when we hide one of the button.</p><p>Note: <strong>Modify(forAxis: .vertical ……</strong> is a helper method in UIStackView extension.</p><p>Github link for complete code.</p><p><a href="https://github.com/LeelaRamala/ButtonsInStackView">LeelaRamala/ButtonsInStackView</a></p><p>Hope this helps!. Suggestions are welcome :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9224db506e46" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>