<?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 Unleased_Coder on Medium]]></title>
        <description><![CDATA[Stories by Unleased_Coder on Medium]]></description>
        <link>https://medium.com/@unleased_coder?source=rss-ebcb9a1e858c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*duVxIDr9h8-Xp7YvZqqwgQ.jpeg</url>
            <title>Stories by Unleased_Coder on Medium</title>
            <link>https://medium.com/@unleased_coder?source=rss-ebcb9a1e858c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:23:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@unleased_coder/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[UIButton’s Little Secret:]]></title>
            <link>https://medium.com/@unleased_coder/uibuttons-little-secret-a3619fc9668c?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3619fc9668c</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[runtime]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[extension]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 20:49:59 GMT</pubDate>
            <atom:updated>2023-11-20T20:51:18.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Magic of OBJC_ASSOCIATION_RETAIN_NONATOMIC</h3><p><strong>Have you wondered what UIButton does in its free time? Turns out, it has a hidden talent that involves associating objects with a touch of humour! </strong>.🤣🤣🤣</p><p>Lets explore how <strong>UIButton</strong> extends its capabilities using associated objects, all while keeping the mood light and entertaining.</p><blockquote><strong>1. Meet the Players</strong></blockquote><p><strong>AssociatedKeys</strong>, our key player. This struct will help us sneak in some custom properties and give UIButton the upgrade it deserves.</p><pre>private struct AssociatedKeys {<br>    static var customObjectKey = &quot;customObjectKey&quot;<br>}</pre><blockquote><strong>2. Meet the Swift Extension</strong></blockquote><p>Time to add a little sparkle to our hero — extending <strong>UIButton</strong> with a <strong>custom property</strong>.</p><blockquote>Some basic info</blockquote><blockquote><strong>I know you all know, still to let you know, we are using extension to add new functionality to an existing Swift class, struct, enumeration or protocol type</strong></blockquote><p>We have created a custom property of Any , and created the getter and setter for this custom property.</p><pre>extension UIButton {<br>    var customObject: Any? {<br>        get {<br>            return objc_getAssociatedObject(self, &amp;AssociatedKeys.customObjectKey)<br>        }<br>        set {<br>            objc_setAssociatedObject(self, &amp;AssociatedKeys.customObjectKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)<br>        }<br>    }<br>}</pre><h3>Q — Hey w<strong>hy we have use Any not AnyObject.</strong>?</h3><blockquote>Sure let me clear air :P</blockquote><blockquote><strong>Any</strong> : can deal with both reference type as well as value type object.</blockquote><blockquote><strong>AnyObject</strong> : deals with reference type only.</blockquote><blockquote>And we want to make our button more powerful to handle all types</blockquote><blockquote><strong>3. Meet the Magic Constant</strong></blockquote><p>let’s decode the magic constant — OBJC_ASSOCIATION_RETAIN_NONATOMIC. This will be our secret sauce for memory management in the associated object world</p><h3>Q<strong> — Wait why this</strong> <em>OBJC_ASSOCIATION_RETAIN_NONATOMIC</em>?</h3><blockquote>OBJC_ASSOCIATION_RETAIN_NONATOMIC is specifying that the associated object (i.e <strong>SuperHero</strong>) should be <strong>retained</strong> by the UIButton, and the association is non-atomic.</blockquote><h3>Q — Lol now what is non atomic ?</h3><blockquote>This is whole seperate concept, need another article, like a boss</blockquote><blockquote><strong>But just to understand basic concept</strong></blockquote><blockquote>Atomic associations provide some level of <strong>thread safety </strong>by ensuring that access to the associated object is atomic.</blockquote><blockquote>However, using <strong>non-atomic</strong> associations is generally preferred for performance <strong>reasons unless</strong> you have specific multithreading requirements</blockquote><h3>Need More explanation, follow my channel, it has MVVM Demo</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjxo2s3PFRbE&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djxo2s3PFRbE&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4a1cc7e45bdb14f66e0c06d1130d4e2/href">https://medium.com/media/b4a1cc7e45bdb14f66e0c06d1130d4e2/href</a></iframe><blockquote><strong>4. Meet the SuperHero custom object we want as a new power for out button</strong></blockquote><p>Create a custom object — the <strong>SuperHero</strong> for our UIButton.</p><pre>class SuperHero {<br>    var name: String<br>    var id: Int<br>    init(name: String, id: Int) {<br>        self.name = name<br>        self.id = id<br>    }<br>}</pre><blockquote><strong>5.Lets make Button and CustomObject (SuperHero )Unite!</strong></blockquote><pre>// Create a button<br>let myButton = UIButton(type: .system)<br>myButton.setTitle(&quot;Click and see the magic&quot;, for: .normal)<br><br>// Create a custom object with parameters<br>let customSuperHeroObject = SuperHero(name: &quot;Wonder Woman&quot;, id: 42)<br><br>// Associate the custom object with the button<br>myButton.customObject = customSuperHeroObject</pre><blockquote><strong>6. Humour in the Mix</strong></blockquote><p>Congratulations! Your UIButton is now a stand-up comedian with a sidekick.</p><blockquote>Embrace the power of associated objects, and remember, coding can be both powerful and entertaining.</blockquote><h3>Your brain might be brewing some interesting queries</h3><h3>Q — Hey is it a runtime feature?</h3><blockquote>Yes</blockquote><blockquote>It’s a runtime feature provided by the Objective-C runtime system, allowing you to associate additional data with an object dynamically.</blockquote><blockquote>In the examples using associated objects(SuperHero) with a UIButton, the objc_setAssociatedObject and objc_getAssociatedObject functions are runtime functions that modify or retrieve associated objects during the execution of the program.</blockquote><blockquote>This dynamic nature is what allows you to add properties to classes at runtime without requiring modifications to their source code or subclassing.</blockquote><h3>Q — <strong>Hey can we use this concept in Swift UI ?</strong></h3><blockquote>The concept of associated is primarily tied to the Objective-C runtime, and is commonly used in UIKit and other Objective-C-based frameworks.</blockquote><blockquote>However, in SwiftUI, <strong>the architecture is quite different.</strong></blockquote><blockquote>In SwiftUI, you can achieve similar functionality using SwiftUI’s property wrappers and environment values.</blockquote><blockquote>The concept of associated objects is not directly applicable, but you can use SwiftUI’s features to achieve similar outcomes.</blockquote><h3>Q — Is in Swift UI using property wrappers is runtime?</h3><blockquote>No</blockquote><blockquote>SwiftUI and property wrappers, are designed to operate at compile time. Swift, being a statically-typed language, performs a lot of checks and optimizations during compilation. SwiftUI’s data flow and property wrappers are part of this static system.</blockquote><blockquote>You want article on Swift UI, comment and let me know</blockquote><blockquote><strong><em>To inspire me, to write more articles like this, kindly follow me</em></strong></blockquote><blockquote>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</blockquote><blockquote>Have You Found It Useful? Comment IT</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3619fc9668c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Heap Sort]]></title>
            <link>https://medium.com/@unleased_coder/heap-sort-ad3572b3c25b?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad3572b3c25b</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[heapsort]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Fri, 17 Nov 2023 13:24:47 GMT</pubDate>
            <atom:updated>2023-11-17T13:29:21.079Z</atom:updated>
            <content:encoded><![CDATA[<p>Small joke for you guys 😜😜😜😜😜</p><p>Why did the array apply for therapy? It had too many issues with heapsort-emotional baggage! 😂</p><p><strong>What is heap sort</strong></p><p>Heap sort is an efficient sorting algorithm, which is based on the comparison of elements.</p><p><em>It works using the Binary Heap data structure, and in most of the cases we use the Max heap, but based on requirements , we can use the Min heap concept as well.</em></p><h3>Wait Wait Wait ….. Could you please let me know what is Heeeeeaaaaapppppp… 🤯</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*coE5HdIk0b20uyPy60q-zg.gif" /></figure><blockquote>Heap data structures are often implemented using arrays, where the parent-child relationships can be represented efficiently. The root of the heap (index 0 in the array) represents the maximum or minimum element, depending on whether it’s a max-heap or min-heap.</blockquote><p><strong>Max-Heap:</strong></p><p><em>In a max-heap, for every node ‘i’ other than the root, the value of ‘i’ is less than or equal to the value of its parent. This means that the largest element in the heap is at the root.</em></p><blockquote><em>if A</em> is an array representing the max heap, and <strong><em>i</em> </strong>is an index such that</blockquote><blockquote>1≤ <em>i </em>≤ <em>A.</em>length, then <em>A</em>[parent(<em>i</em>)] ≥ <em>A</em>[<em>i</em>]</blockquote><p><strong>Min-Heap:</strong></p><p><em>In a min-heap, for every node ‘i’ other than the root, the value of ‘i’ is greater than or equal to the value of its parent. This means that the smallest element in the heap is at the root.</em></p><blockquote><em>if A</em> is an array representing the max heap, and <strong><em>i</em> </strong>is an index such that</blockquote><blockquote>1 ≤ <em>i </em>≤ <em>A.</em>length, then <em>A</em>[parent(<em>i</em>)] ≤ <em>A</em>[<em>i</em>]</blockquote><h3>Okay how I can visualize, could you please help me with that.</h3><h3>🤣🤣🤣🤣🤣</h3><p>Lets laugh first 😜😜😜😜😜</p><blockquote>“Picture a heap like a tree where each element competes to be the ‘top banana’ or the ‘humblest potato,’ depending on the mood. Turning an array into a heap is like organizing a potluck — everyone needs to know their place.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyuOf4oySfHDANyOvwhA3A.png" /></figure><p>Hope you gotcha! how to visualize heap… with my awesome drawing skills 🤣😂</p><h3><strong>Reasons why heap sort might a choice:</strong></h3><blockquote>1) This is an in-place sorting algorithm, means ,</blockquote><ul><li>No more additional space needed to sort elements, same array can be used</li></ul><blockquote>2) The worst-case time complexity of heap sort is O(n log n), which is the same as quicksort and mergesort, means,</blockquote><blockquote>Heap sort efficient for large datasets, especially when worst-case performance is a concern.</blockquote><blockquote>3) It has a predictable behavior means,</blockquote><p>The same input should always produce the same sorted output.</p><h3>Despite its advantages, heap sort is not always the best choice</h3><blockquote>1) Heap sort is not a stable sorting algorithm. However, in certain applications, stability is not a critical requirement, and the efficiency of heap sort may outweigh the need for stability.</blockquote><blockquote>2) It may be outperformed by other algorithms like quicksort or mergesort in certain scenarios, depending on factors such as the size of the dataset, available memory, and the distribution of the data.</blockquote><h3>Heap Sort Algorithm</h3><p>Funny way to explain LOL 🤣🤣🤣🤣🤣</p><blockquote>Heap sort is basically the sorting version of musical chairs, where elements find their spot one by one until the music stops and voilà, you’ve got a sorted array.</blockquote><p>Lets see the</p><ol><li>English Algo</li><li>Code in Swift</li><li>Code in Java</li></ol><h4>Heap sort just have 3 simple steps Guys… yeahhhhhh…..we all can remember…</h4><p><strong># Step 1: </strong>Build Max Heap -&gt; Starting from last node</p><p><strong># Step 2: </strong>Extract Max, Swap and ….. Lol 🤣 Just repeat the algo again.</p><blockquote><strong>Both Step1 and Step2 will use a common function known as Heapify</strong></blockquote><p><strong>Heapify</strong> -&gt;</p><p>Will max sure that for every index i, we would definitely re-arrange the array in a way that it must be the Max Heap and it satisfies that rule</p><blockquote>means at any <strong><em>i</em> </strong>is an index such that 1 ≤ <em>i </em>≤ <em>A.</em>length, then <em>A</em>[parent(<em>i</em>)] ≤ <em>A</em>[<em>i</em>]</blockquote><p>For detailed explanation</p><blockquote><strong>1) Build Max Heap:</strong></blockquote><blockquote>Start from the last non-leaf node ([n/2] −1) and move upward to the root.</blockquote><blockquote>For each node <em>i</em>, perform the Heapify operation to ensure the max heap property:</blockquote><blockquote>If the left child (2n+1) exists and is greater than the node at <em>i</em>, swap them.</blockquote><blockquote>If the right child (2n+2) exists and is greater than the node at <em>i</em> (or the left child), swap them.</blockquote><blockquote>Recursively apply Heapify to the affected subtree.</blockquote><blockquote>Continue this process until the entire array satisfies the max heap property.</blockquote><pre>Build_Max_Heap(arr):<br> n = arr.length;<br> for (i = n / 2 - 1; i &gt;= 0; i--) {<br>        Heapify(arr, n, i)<br>}</pre><blockquote>3) Extract Max, Swap, and Repeat:</blockquote><blockquote>After building the max heap, the largest element is at the root. Swap it with the last element of the array and reduce the size of the heap (<em>n</em>−1).</blockquote><blockquote>Perform Heapify on the <strong><em>root</em></strong> to maintain the max heap property.</blockquote><blockquote>Repeat this process until the entire array is sorted.</blockquote><pre>Heap_Sort(arr):<br>    Build_Max_Heap(arr)<br>     // Step 3<br>    for i from n-1 to 1:<br>        swap(arr[0], arr[i])<br>        Heapify(arr, i, 0)</pre><blockquote><strong>Heapify: the common function.</strong></blockquote><blockquote>Given an array and an index <em>i</em>:</blockquote><blockquote>Compare the element at <em>i</em> with its left child (2i+1) and right child (2<em>i</em>+2).</blockquote><blockquote>If the left or right child is greater, swap the element at <em>i</em> with the greater child.</blockquote><blockquote>Recursively apply Heapify to the affected subtree.</blockquote><blockquote><strong>Base case: </strong>Stop when the subtree rooted at <em>i</em> satisfies the max heap property.</blockquote><pre>Heapify(arr, n, i):<br>    largest = i<br>    left_child = 2 * i + 1<br>    right_child = 2 * i + 2<br><br>    if left_child &lt; n and arr[left_child] &gt; arr[largest]:<br>        largest = left_child<br><br>    if right_child &lt; n and arr[right_child] &gt; arr[largest]:<br>        largest = right_child<br><br>    if largest != i:<br>        swap(arr[i], arr[largest])<br>        Heapify(arr, n, largest)</pre><p>If you want to see the detailed explanations, watch my youtube unorganised video 🤣🤣🤣🤣🤣</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJygmlgWPhHk&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJygmlgWPhHk&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=google" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6751e5cd609d101a479f8705eebdc480/href">https://medium.com/media/6751e5cd609d101a479f8705eebdc480/href</a></iframe><p><strong>Git Repo :</strong><a href="https://github.com/MamtaiOS13/HeapSort"> https://github.com/MamtaiOS13/HeapSort/tree/main</a></p><h3>Need Code Please :</h3><blockquote>In Swift</blockquote><pre>import UIKit<br><br>func heapify(a: inout [Int], n: Int, index: Int) {<br>    <br>    var large = index<br>    var lc = 2*index + 1<br>    var rc = 2*index + 2<br>    <br>    // check if left child value is large<br>    if (lc &lt; n &amp;&amp; a[lc] &gt; a[large]) {<br>        large = lc<br>    }<br>    <br>    // check if right child value is large<br>    if (rc &lt; n &amp;&amp; a[rc] &gt; a[large]) {<br>        large = rc<br>    }<br>    <br>    // base case to break the recursion<br>    if (large != index) {<br>        let temp = a[index]<br>        a[index] = a[large]<br>        a[large] = temp<br>        heapify(a: &amp;a, n: n, index: large)<br>    }<br>}<br><br>func buildMaxHeap(a: inout [Int]) {<br>    let n = a.count<br>    for i in (0...(n / 2 - 1)).reversed() {<br>        // Step1 and Step2 both uses heapify<br>        heapify(a: &amp;a, n: n, index: i)<br>    }<br>}<br><br>func heapSort(a: inout [Int]) {<br>    let n = a.count<br>    // Step 1<br>    buildMaxHeap(a: &amp;a)<br>    <br>    // Step 2<br>    for i in (1..&lt;n).reversed() {<br>        // Swap elements<br>        let temp = a[0]<br>        a[0] = a[i]<br>        a[i] = temp<br>        // Step1 and Step2 both uses heapify<br>        heapify(a: &amp;a, n: i, index: 0)<br>    }<br>}<br><br>var a = [12, 11, 13, 5, 6, 7]<br>print(&quot;Old Array :&quot;, a)<br>heapSort(a: &amp;a)<br>print(&quot;\nNew Sorted Array :&quot;, a)</pre><blockquote>In Java</blockquote><pre>public class HeapSort {<br><br>public static void heapify(int[] a, int n, int i) {<br><br>int large = i ;<br>int lc = 2*i + 1;<br>int rc = 2*i + 2;<br><br>// check if left child value is large<br>if (lc &lt; n &amp;&amp; a[lc] &gt; a[large]) {<br>    large = lc;<br>}<br><br>// check if right child value is large<br>if (rc &lt; n &amp;&amp; a[rc] &gt; a[large]) {<br>    large = rc;<br>}<br>// base case to break the recursion<br>if(large != i) {<br>    swap(a, i, large);<br>    heapify(a, n, large);<br>}<br>}<br><br>public static void buildMaxHeap(int[] a) {<br>        int n = a.length;<br>        for(int i = n/2 - 1; i &gt;= 0; i--){<br>        //Step1 and Step2 both uses heapify<br>            heapify(a, n, i);<br>        }<br> }<br><br>public static void swap(int[] a, int i, int j){<br>        int temp = a[i];<br>        a[i] = a[j];<br>        a[j] = temp;<br>}<br><br>public static void printArray(int[] a){<br>        for(int num : a) {<br>          System.out.print(num + &quot; &quot;);<br>        }<br>}<br><br>public static void heapSort(int[] a) {<br>        int n = a.length;<br>        // Step 1 <br>        buildMaxHeap(a);<br><br>        // Step 2<br>        for(int i = n-1 ; i &gt; 0; i--){<br>            swap(a, 0, i);<br>          //Step1 and Step2 both uses heapify<br>            heapify(a, i, 0);<br>        }<br>}<br><br>public static void main(String[] args) {<br>    int[] a = {12, 11, 13, 5, 6, 7};<br>    System.out.println(&quot;Old Array&quot;);<br>    printArray(a);<br>    heapSort(a);<br>    System.out.println();<br>    System.out.println(&quot;New Array&quot;);<br>    printArray(a);<br>    System.out.println();<br>}<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*7z4OS3bD_XmGoWdIvivWUw.png" /></figure><h3>Lets learn about few factors before you choose any sorting alogs.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*Uga0eOYdVqSr5X3HrrO7Ng.gif" /></figure><ol><li><strong>Time Complexity</strong>:</li></ol><blockquote>This is one of the most crucial factors. The time complexity of a sorting algorithm indicates how the algorithm’s performance scales with the size of the input data. Common notations for time complexity include O(n²), O(n log n), and O(n).</blockquote><p><strong>2. Space Complexity:</strong></p><blockquote>Some sorting algorithms require additional memory space to perform their operations, while others can sort the data in-place, without requiring extra memory. In-place algorithms are often preferred in situations where memory usage is a concern.</blockquote><p><strong>3. Stability:</strong></p><blockquote>A sorting algorithm is stable if the relative order of equal elements remains unchanged after sorting. Stability is important in situations where you want to preserve the original order of equal elements.</blockquote><p><strong>What is this even means? </strong>🫣</p><p>Let say [1,1,3] ….here both 1, 1 should be in the same order after sorting the array is what we need defines the <strong>Stability</strong> in nature.</p><p><strong>4. Adaptability</strong>:</p><blockquote>An adaptive sorting algorithm performs better when the input data is partially ordered. If a large portion of the input data is already sorted, an adaptive algorithm can take advantage of this and improve its performance.</blockquote><p><strong>What is this even means? </strong>🫣</p><p>Means if we have partially sorted array then the performance of sorting algos should be optimised</p><p><strong>5. Ease of Implementation:</strong></p><blockquote>Some sorting algorithms are simpler to implement than others. The ease of implementation can be a significant factor, especially for smaller datasets or situations where simplicity and clarity are prioritized over optimal performance.</blockquote><p>6. <strong>Average and Worst-Case Scenarios:</strong></p><blockquote>Understanding the average and worst-case time complexities is essential. In some cases, an algorithm might perform well on average but have a poor worst-case scenario, which could be critical in certain applications.</blockquote><p><strong>-&gt; Will create one more post on the time and space complexity….</strong></p><p><strong>7. Data Distribution:</strong></p><blockquote>The distribution of data (uniform, partially ordered, reverse ordered, etc.) can influence the performance of different sorting algorithms. Some algorithms may perform better on certain types of data distributions.</blockquote><p><strong>8. Best-Case Scenario:</strong></p><blockquote>While worst-case performance is often the focus, considering the best-case scenario is also important. For some algorithms, the best-case scenario might be a significant factor in choosing the right algorithm.</blockquote><p><strong>9. Size of Data:</strong></p><blockquote>The size of the dataset can influence the choice of sorting algorithm. Some algorithms perform better on small datasets, while others are designed for efficient sorting of large datasets.</blockquote><p>10. <strong>Hardware Constraints:</strong></p><blockquote>The characteristics of the hardware on which the algorithm will run can also be a consideration. Some algorithms may be better suited for parallel processing or take advantage of specific hardware features.</blockquote><p><strong>11. External Sorting:</strong></p><blockquote>For sorting large datasets that do not fit into memory, external sorting algorithms that efficiently use external storage (such as disk drives) become relevant.</blockquote><p><strong>12. Programming Language and Libraries:</strong></p><blockquote>The programming language and available libraries can influence the choice of sorting algorithm. Some languages provide built-in sorting functions that are optimized for performance.</blockquote><h3>Yup, we are done.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*tdKuhDFFCKCTltyxt4Hesw.gif" /></figure><blockquote><strong>To inspire me, to write more articles like this, kindly follow me</strong></blockquote><blockquote><em>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</em></blockquote><blockquote><em>Have You Found It Useful? Comment IT</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad3572b3c25b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UIViewControllerRepresentable in Swift UI]]></title>
            <link>https://medium.com/@unleased_coder/uiviewcontrollerrepresentable-in-swift-ui-a7bf15b9bdba?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7bf15b9bdba</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[concept]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 19:57:13 GMT</pubDate>
            <atom:updated>2023-11-04T19:57:13.840Z</atom:updated>
            <content:encoded><![CDATA[<p>To present and dismiss a custom UIViewController on top of a SwiftUI view, you can create a UIViewRepresentable that will handle the presentation and dismissal of the view controller. Here’s an example implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0rhizwf5CMirTtTG.png" /></figure><p>Create the custom view controller class</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*tFPXa3x2ypOpbzHF.png" /></figure><p>In this example, CustomViewController is a UIViewControllerRepresentable</p><p>that takes a boolean <strong>isPresented</strong> binding to control the presentation and dismissal of the custom view controller.</p><p>In <strong>makeUIViewController</strong>, a new UIViewController instance is created and its background color is set to a semi-transparent black color.</p><p>The CustomViewControllerContent is presented modally on top of the background view controller, with a presentation style of .<strong>overCurrentContext</strong>. In <strong>updateUIViewController</strong>, the view controller is dismissed if isPresented is false.</p><p>To use the <strong>CustomViewController</strong>, you can add it as a background view to your SwiftUI view and pass in the isPresented binding:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w7USn1A7wHfJBVzv.png" /></figure><p>In this example, the ContentView contains a button that sets the <strong>isShowingCustomViewController</strong> state variable to true when pressed.</p><p>The Text view is displayed below the button. The background modifier is used to present the CustomViewController on top of the content views when <strong>isShowingCustomViewController</strong> is true.</p><p>When the button is pressed again or when the user dismisses the custom view controller by tapping outside of it, the <strong>isShowingCustomViewController</strong> state variable is set to false, which triggers the dismissal of the custom view controller through the CustomViewController<strong>‘s</strong> <strong>updateUIViewController</strong> method.</p><p>You can customize the appearance and content of the <strong>CustomViewControllerContent</strong> to suit your needs.</p><h3>To inspire me, to write more articles like this, kindly follow me</h3><blockquote><em>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</em></blockquote><blockquote><em>Have You Found It Useful? Comment IT</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7bf15b9bdba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Microservices and what is the importance, which languages we can choose to learn.]]></title>
            <link>https://medium.com/@unleased_coder/what-is-microservices-and-what-is-the-importance-which-languages-we-can-choose-to-learn-8f9a8c3f8dc1?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f9a8c3f8dc1</guid>
            <category><![CDATA[general]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[concepts-for-beginners]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 19:54:12 GMT</pubDate>
            <atom:updated>2023-11-04T19:54:12.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3b_xVyu4u8ZNa1uk518zmA.jpeg" /></figure><blockquote>Microservices is an architectural approach to building software applications where an application is divided into a collection of small, independently deployable services that communicate with each other over a network. Each service in a microservices architecture is responsible for a specific piece of functionality and can be developed, deployed, and scaled independently. This is in contrast to a monolithic architecture where all the functionality is bundled into a single, large application.</blockquote><p>Here are some key aspects and reasons for learning about microservices:</p><blockquote><strong>Scalability</strong>: Microservices allow for individual services to be scaled independently based on demand. This means you can allocate more resources to the parts of your application that need it the most, improving overall system scalability.</blockquote><blockquote><strong>Flexibility</strong>: Microservices provide flexibility in terms of technology stack. Different services can use different programming languages, frameworks, and databases, which is not as easily achievable in a monolithic architecture.</blockquote><blockquote><strong>Easy Maintenance</strong>: Smaller codebases are easier to maintain, understand, and debug. Changes and updates to one service do not necessarily impact other services, reducing the risk of introducing bugs unintentionally.</blockquote><blockquote><strong>Faster Development</strong>: Smaller teams can work on individual services, enabling faster development cycles. This can lead to quicker feature releases and a more agile development process.</blockquote><blockquote><strong>Resilience</strong>: Microservices are designed to be resilient. If one service fails, it doesn’t necessarily bring down the entire application, as other services can continue to operate.</blockquote><blockquote><strong>Continuous Delivery</strong>: Microservices are well-suited for continuous integration and continuous delivery (CI/CD) pipelines, allowing for automated testing and deployment of individual services.</blockquote><blockquote><strong>Elasticity</strong>: Microservices can be deployed in cloud environments and take advantage of auto-scaling features, ensuring that resources are allocated efficiently.</blockquote><h3>Languages</h3><p>To choose for building microservices backends, there isn’t a single “best” language, as the choice depends on various factors including your team’s expertise, the specific requirements of your project, and the existing technologies in your ecosystem. However, some popular languages for building microservices include:</p><p><strong>Java</strong>:</p><blockquote>Java has been a traditional choice for building microservices due to its performance and ecosystem of libraries and frameworks, including Spring Boot.</blockquote><p><strong>Node.js</strong>:</p><blockquote>Node.js is known for its non-blocking I/O and is often used for building lightweight and highly scalable microservices.</blockquote><p><strong>Python</strong>:</p><blockquote>Python is known for its simplicity and readability, making it a good choice for rapid development of microservices.</blockquote><p><strong>Go (Golang)</strong>:</p><blockquote>Go is designed for building efficient and performant applications, making it a strong choice for microservices that require high performance.</blockquote><p><strong>Ruby</strong>:</p><blockquote>Ruby on Rails can be used to build microservices, particularly when you already have expertise in Ruby.</blockquote><p><strong>Kotlin</strong>:</p><blockquote>Kotlin is a modern language that runs on the Java Virtual Machine (JVM) and is gaining popularity for microservices development.</blockquote><p><strong>Scala</strong>:</p><blockquote>Scala, also running on the JVM, provides a powerful and expressive language for building microservices.</blockquote><p><strong>C#</strong>:</p><blockquote>C# is commonly used for microservices development, especially in Windows environments, often with the ASP.NET Core framework.</blockquote><p>Ultimately, the choice of programming language should align with your project’s goals, your team’s expertise, and the specific requirements of your microservices architecture. It’s also important to consider factors like community support, documentation, and ecosystem when making your decision.</p><blockquote><strong>Many more blogs on Microservices would be coming soon.</strong></blockquote><h3>To inspire me, to write more articles like this, kindly follow me</h3><blockquote><em>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</em></blockquote><blockquote><em>Have You Found It Useful? Comment IT</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f9a8c3f8dc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI, Rise of Chat GPT]]></title>
            <link>https://medium.com/@unleased_coder/ai-rise-of-chat-gpt-9ab6a41c3ecd?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ab6a41c3ecd</guid>
            <category><![CDATA[general]]></category>
            <category><![CDATA[chat-gpt-ai]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[open-ai-api]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 19:41:06 GMT</pubDate>
            <atom:updated>2023-11-04T19:42:17.647Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTTe7-BftCKF5U8oWLHQRg.jpeg" /></figure><p><strong>THE BIRTH OF AI</strong></p><p>The term Artificial Intelligence (AI) was first coined at Dartmouth College in 1956 and has often been attributed to American computer scientists, <strong>Marvin Minsky </strong>and J<strong>ohn McCarthy</strong>, known pioneers of the movement.</p><p><a href="https://home.dartmouth.edu/about/artificial-intelligence-ai-coined-dartmouth#:~:text=1956,of%20this%20field%20of%20research.">https://home.dartmouth.edu/about/artificial-intelligence-ai-coined-dartmouth#:~:text=1956,of%20this%20field%20of%20research.</a></p><p>Both scientists were optimistic about the future of Al, which enabled machines to simulate human intelligence and achieve specific goals.<br>However, it is British mathematician <strong>Alan Turing</strong>, who is widely regarded as the founding father of Artificial Intelligence by virtue of the Turing Test, a criterion for determining the level of a computer’s ability to ‘think’ like a human, a popular benchmark used even today.</p><p>Essentially, Artificial Intelligence comprises Machine Learning and Deep Learning. <strong>The former</strong> refers to machines automatically learning from existing data without human intervention, <strong>while the latter </strong>includes artificial neural networks that enable machines to process large amounts of unstructured data to achieve more sophisticated results.<br>Artificial Intelligence is divided into two broad categories:</p><p><strong>Narrow Al:</strong></p><blockquote>A limited form of AI focused on performing a simple task well, such as a Google search, or a command to personal assistants such as Siri or Alexa.</blockquote><p><strong>General Al:</strong></p><blockquote>This form of far-fetched, human level Al allows machines to comprehend, learn, and perform intellectual tasks to solve any kind of complex problem — much like humans! Also known as Artificial General Intelligence (AGI), it’s still in the theoretical stage, although Hollywood’s apocalyptic Terminator like representations have often provided fodder for fantasy,</blockquote><p><strong>TAKING FLIGHT</strong></p><blockquote>Over the years, AI has witnessed a gradual accumulation of breakthroughs such as deep learning algorithms and neural networks, which have facilitated the creation of intelligent systems capable of performing tasks that were previously thought to be the exclusive domain of humans.</blockquote><blockquote>Additionally, the increased availability of computing power and specialised hardware such as <strong>Graphics Processing Units (GPUs)</strong> and<strong> Tensor Processing Units (TPUs) </strong>have been instrumental in the integration of <strong>AI</strong> into a wide range of industries-from detecting life-threatening diseases in healthcare to improving fraud detection and risk management in banking and recommending new products in e-commerce.<br>In India alone, the formidable software sector is likely to lead the market for AI and is expected to grow to <strong>US$7.8 billion</strong> by 2025 at a healthy CAGR (compound annual growth rate) of 20.2 per cent, according to market intelligence firm, International Data Corporation (IDC).<br>Al’s ubiquity across the globe has been advancing steadily, as well, with companies like</blockquote><p><strong>Tesla now pushing the envelope to deploy path-breaking tools at scale. In early March 2023,</strong></p><blockquote><em>‘Tesla founder Elon Musk showcased the latest version of his humanoid robot, Optimus, predicting that these machines could potentially outnumber humans in the future, and the company’s robotics business would soon surpass its renowned vehicles division.</em></blockquote><p><strong>THE RISE OF CHATGPT</strong></p><blockquote>In November 2022, Microsoft co-owned artificial intelligence research firm OpenAl released a user-friendly bot, ChatGPT, based on its <strong>GPT 3.5 language model trained on Azure</strong>, the company’s cloud business. Within a week of its release, ChatGPT had reported one million users<br>Entrepreneurs, engineers, academics, and casual users alike unanimously praised the revolutionary tool for its ability to have intelligent sounding conversations, write music and poetry, as well as complex code.</blockquote><blockquote>Big Tech had clearly anticipated the immense, far-reaching potential of this multi-layered field much in advance. Which is why, in 2019, Microsoft invested <strong>US$1 billion</strong> in San Francisco-based OpenAl, co-founded by <strong>Y Combinator alum Sam Altman and Elon Musk </strong>just over seven years earlier. The software giant reportedly followed up with another silent investment of US$2 billion in 2021 and in late January 2023, confirmed a third round of investment of US$10 billion in the company, valuing it at a whopping US$29 billion.</blockquote><blockquote>Evidently, even amidst the company’s current downsizing, Microsoft is placing a big bet on AI. As per CEO <strong>Satya Nadella</strong>, “In the next phase of our partnership, developers and organisations across industries will have access to the best AI infrastructure, models, and toolchains with Azure (their cloud computing platform) to build and run their applications.”<br>Experts are already referring to ChatGPT as ‘AI’s iPhone moment’ Much like Apple’s flagship product birthed a cultural revolution upon its launch in 2007, OpenAl’s trailblazing tool could soon follow suit.</blockquote><blockquote>The bot has already passed an MBA exam prepared by a Wharton professor and cleared a coding exam for an Amazon interview, albeit with a few errors, possibly owing to its disclaimer that its knowledge is limited up to September 2021.<br>Nevertheless, the technology has left industry insiders both scared and excited for the future.</blockquote><blockquote>Recognising the need for speed to maintain its lead, Microsoft is moving fast. OpenAI has already announced a paid, professional version of their tool called <strong>ChatGPT Professional</strong> that will include faster responses, unlimited messages, and zero downtime.</blockquote><blockquote>The move has met with sharp criticism from OpenAl’s original co-founder Elon Musk, who lamented Microsoft’s closed-source, profit-driven motives rather than the non-profit, for-the-greater-good values the company was originally founded upon.</blockquote><p><strong>THE RACE FOR SUPREMACY</strong></p><blockquote>The competitive landscape is heating up. In February 2023, Meta joined the AI chatbot race with its own state-of-the-art foundational language model called LLaMA (Large Language Model Meta AI).<br>CEO Mark Zuckerberg signalled the company’s laser focus on developing generative AI tools that can enhance creativity- in Instagram filters, as well as in chat applications like WhatsApp and Messenger.</blockquote><blockquote>ChatGPT’s instant popularity has ruffled many feathers, particularly at rival Alphabet, the parent company of Google. The latter’s management has already declared a ‘code red’ within its ranks amidst concerns that OpenAl’s chatbot could hamper its unparalleled lead in the web search engine business, which brings in over 80% of its revenues.</blockquote><blockquote>In February 2023, a mere three months after ChatGPT’s release, Alphabet soon announced its own experimental conversational<br>AI service called <strong>Bard</strong>. Powered by their own <strong>LaMDA (Language Model for Dialogue Applications)</strong>, Bard’s debut was marred by a factually inaccurate response in its first public demonstration, which resulted in 8% drop in Alphabet’s shares and, equally bad, a loss of <strong>US$100</strong> billion in market capitalisation, just as Microsoft announced it was augmenting its Bing web search engine with AI features from OpenAl</blockquote><blockquote><strong>THE FUTURE IS COMING</strong></blockquote><blockquote>Artificial Intelligence is a rapidly evolving landscape shaping the future of humanity and its impact across our lives will be hard to ignore.<br>While ChatGPT has recently entered the public conscience, a suite of other generative AI tools is already automating a number of tasks-creating stunning images and music, as well as writing social media posts, often in a far more cost-effective manner and with superior results compared to humans.</blockquote><blockquote>Inevitably, the creator economy, as well as marketing and sales functions, are ripe for disruption as Al accelerates redundancy and enhances efficiency to potentially unlock trillions of dollars in economic value in the future.</blockquote><blockquote>Kai-Fu Lee, a Taiwanese computer scientist and author of the New York Times bestseller, AI Superpowers, warned that those with jobs that involve repetitive tasks must learn new skills before they are displaced by AI. This is probably why Mare Gyöngyösi, founder of <strong>OneTrack.AI </strong>strongly advocates that the newer generation learn more about programming.</blockquote><p><strong>“In the future, if you don’t know coding, it’s only going to get more difficult.”</strong></p><blockquote>David Vandegrift, Al aficionado and CTO of CRM firm, 4 Degrees, adds, “Much like America’s transition from an agricultural economy to an industrial one played a role in the Great Depression, the transition between jobs made redundant by Al and new ones being created won’t be a painless one.”<br>At the same time, Al heralds a period of great promise, with optimised operations across various businesses.</blockquote><blockquote>‘This could include fast analysis of medical data and tests to facilitate improved healthcare, quick delivery of products and automate services in the retail, media, and banking sectors, and a substantial increase in AI related jobs (engineers, programmers, data scientists, and more) in the coming years.</blockquote><p><strong>As Tim Cook, CEO of Apple,</strong> said,</p><blockquote>“What all of us have to do is to make sure we are using Al in a way that is for the benefit of humanity, not to the detriment of humanity.”</blockquote><h3>To inspire me, to write more articles like this, kindly follow me</h3><blockquote><em>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</em></blockquote><blockquote><em>Have You Found It Useful? Comment IT</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ab6a41c3ecd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THREAD SANITIZER: XCODE]]></title>
            <link>https://medium.com/@unleased_coder/thread-sanitizer-xcode-b9c673106b77?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9c673106b77</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[concept]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 19:28:55 GMT</pubDate>
            <atom:updated>2023-11-04T19:28:55.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDdqEH8FFGqHnpMYMEGjgA.png" /></figure><p>Thread Sanitizer — also known as TSan, is a debugging tool that detects race conditions, between threads.</p><p>// Sanitizer: “Removing bugs from hands” 😛</p><blockquote><em>Curious to know more, let’s dive in</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/0*bBUE2VG2gmoTnvwg.png" /></figure><h3>Concepts that should be understood before using Thread Sanitizer.</h3><h3>What is a thread?</h3><blockquote>A thread is sequence of instructions that can be executed by a runtime.</blockquote><blockquote>Lets say, in an application you might have one write thread, that would perform write operation, and another would be read thread, that would perform the read operation.</blockquote><blockquote>Threads are especially useful when you need to perform a lengthy task, but don’t want it to block the execution of the rest of the application, so you divide the whole code into separate threads, that would be doing separate tasks.</blockquote><blockquote>Each application in OS X or iOS is made up of one or more threads, each of which represents a single path of execution through the application’s code.</blockquote><blockquote>Every application starts with a single thread, which runs the application’s main function.</blockquote><h3>What is the data race condition?</h3><blockquote><em>Data race, is actually a part of Concurreny Problems.</em></blockquote><p><strong><em>As we all know how critical is to keep track of all the accesses to a shared variable, in a way that no two threads would be able to access the same shared variable at the same time.</em></strong></p><p>Basically, data race is nothing but accessing the same shared address from different threads at the same time.</p><blockquote><em>Lets’ understand with small e.g</em></blockquote><blockquote><em>Shared resource or variable : </em><strong><em>Account_Balance</em></strong></blockquote><blockquote><em>And the two threads are:</em></blockquote><blockquote><strong><em>Thread 1 -&gt; </em></strong><em>will update the account balance, so that would be a write thread</em></blockquote><blockquote><strong><em>Thread 2-&gt;</em></strong><em> will read the account balance, so that would be a read thread.</em></blockquote><blockquote><strong><em>So if Thread 1 and Thread 2 would try to access, or modify the Account_Balance variable, at the same time, without synchronization, this would leads to Data race.</em></strong></blockquote><h3>So in general data race is</h3><ul><li>Multiple threads access the same memory without synchronization</li><li>At least one access is a write</li><li>May end up with any value or even memory corruption!</li></ul><h3>What is the impact of race conditions?</h3><blockquote><em>So if two threads will try to access the same address, then we would end up with below stated problems.</em></blockquote><ul><li>Unpredictable behavior</li><li>Memory corruption</li><li>Flaky tests: <strong><em>Tests that return both passes and failures despite no changes to the code or the test itself</em></strong><em>.</em></li><li>Weird crashes</li></ul><p>Understood a few concepts, 100% awesome…. But …. curious to know more like…..</p><blockquote><strong><em>What is the use of Thread Sanitizer?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2t0tgKNFxKt_cyy9.jpeg" /></figure><blockquote><strong><em>Ans :</em></strong></blockquote><blockquote><em>The Thread Sanitizer, commonly referred to as TSan, is a tool Apple provides as part of the LLVM compiler.</em></blockquote><blockquote><em>TSan allows you to identify when multiple threads attempt to access the same memory without providing proper access synchronization.</em></blockquote><blockquote><em>We usually enable this as we know we are working in a multi threaded environment, and we would be having Data race and other weird cases.</em></blockquote><blockquote><strong>How we can enable TSan, to detect these conditions in a multi-threaded environment?</strong></blockquote><p>Ans:Note: TSan is only supported when running on the simulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o5fzh5I5HZ29oIZB.png" /></figure><h3>Thread Sanitizer (TSan) in Xcode</h3><ol><li><em>Edit Scheme- Run — Diagnostics tab</em></li><li><em>“Enable Thread Sanitizer” checkbox</em></li><li><em>Build and Run</em></li><li><em>View all of the generated runtime issues</em></li></ol><h3>Note: TSan is only supported when running on the simulator.</h3><h3>Awesome, let’s learn more…..</h3><blockquote><strong><em>What all problems we can debug using this Tool?</em></strong></blockquote><p>Ans:</p><ol><li>Data races</li><li>Swift access races</li><li>Races on collections and other APIs</li><li>Uninitialized mutexes</li><li>Thread leaks</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*ShPnZMuLbxO-YC9M.png" /></figure><p><strong>Before diving into this, just wanted to nudge that</strong></p><blockquote><em>Using Actors we can solve data races</em></blockquote><blockquote><em>The Concurrency Framework announced at WWDC 2021 introduced Actors for synchronizing access to data. This is the best solution for solving data access-related bugs and should be more straightforward than dispatch queues.</em></blockquote><blockquote><em>To show the concept of how TSan detects each issues , and to know exactly where we have to fix the issue, we used dispatch queues to fix the problem</em></blockquote><h3>Let’s start</h3><h3>1) Data races</h3><blockquote><em>Detects unsynchronized access to mutable state across multiple threads.</em></blockquote><p>How data race occurs?</p><p>// We create a lazy testVariable, and check below how two thread access the same lazy var, and ends up in a data race issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2llxCFUBNxNiExhk.png" /></figure><blockquote><em>Enable the TSan tool from the edit schema, now run again you will see the error, as shown below</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hpiUexAO78k1tfqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o6etrW5wRQi40qrl.png" /></figure><blockquote><em>Check the terminal, it says data race issues with the getter.</em></blockquote><h3>Let’s fix this</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xFEGX3h7kTclVIFX.png" /></figure><blockquote><em>// We can fix this by creating a </em><strong><em>lockQueue</em></strong><em> using DispatchQueue</em></blockquote><blockquote><em>// Using a lock queue, we synchronized access and ensured that only one thread at a time accessed the testVariable variable</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/0*agMqNNRJEJZCzGkM.gif" /></figure><blockquote><strong><em>Data race… I know how to debug inside a large code base.</em></strong></blockquote><h3>Yoii… Let’s learn about more issue</h3><h3>2) Swift access races</h3><blockquote><em>Detects unsynchronized access to mutable state across multiple threads in Swift.</em></blockquote><p><strong>How swift access races occur?</strong></p><blockquote><em>// We create a variable access_Issue_Var</em></blockquote><blockquote><em>// Check below how one thread does the write access, and another does the read access at the same time and ends up in a swift access race.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FziD8zN2XKDYmB9H.png" /></figure><blockquote><em>When we run the code, Tsan will report the issue, as shown below</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_zmVLM5ljJcRfola.png" /></figure><blockquote><em>Check the terminal, it says Swift access race issues with the getter.</em></blockquote><h3>Let’s fix this</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9UXTLjBG9KDgKqLS.png" /></figure><blockquote><em>// We can fix this by creating a </em><strong><em>lockQueue</em></strong><em> using DispatchQueue</em></blockquote><blockquote><em>// Using a lock queue, we synchronized access and ensured that only one thread at a time accessed can either do a read or a write operation.</em></blockquote><h3>3) Races on collections and other APIs</h3><blockquote><em>Detects when one thread accesses a mutable object while another thread is writing to it.</em></blockquote><p>// This is more related to when we are working with Array, Dict, or any collection types</p><p><strong>How do Races on collections and other APIs occur?</strong></p><blockquote><em>// We create an array collection variable, named as array inside the function</em></blockquote><blockquote><em>// Check below how the one thread enumerates a mutable array, and another does the write access at the same time and ends up in a swift access race on collections.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QDncJwuzUxY0ozza.png" /></figure><blockquote><em>When we run the code, Tsan will report the issue, as shown below</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MTWLw_c8tD3C81kI.png" /></figure><blockquote><em>Check the terminal, it says Swift access race on collection.</em></blockquote><h3>Let’s fix this</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R4Euv0CtEGoceYCl.png" /></figure><blockquote><em>// We can fix this by creating a </em><strong><em>lockQueue</em></strong><em> using DispatchQueue</em></blockquote><blockquote><em>// Using a lock queue, we synchronized access and ensured that only one thread at a time accessed can either do a read or a write operation.</em></blockquote><h3>4) Uninitialized mutexes</h3><blockquote><em>Detects when you use an uninitialized mutex.</em></blockquote><p><strong>What does Tsan detect in this case?</strong></p><p>// When we use any c libraries inside the swift code, and declare an uninitialized mutex variable,</p><p>// Tsan reports the issue that mutex is uninitialized.</p><pre>static pthread_mutex_t mutex; // declare an uninitialized mutex variable</pre><pre>void performWork() {<br>   pthread_mutex_lock(&amp;mutex); // Error: uninitialized mutex<br>   // ...<br>   pthread_mutex_unlock(&amp;mutex);<br>}</pre><h3>Let’s fix this</h3><p>Use the pthread_once(_:_:) function to initialize a mutex before you use it, check below</p><pre>// To Fix we created a once var<br>static pthread_once_t once = PTHREAD_ONCE_INIT;</pre><pre>static pthread_mutex_t mutex;</pre><pre>// Initialize the mutext before use<br>void init() {   <br>   pthread_mutex_init(&amp;mutex, NULL);<br>}</pre><pre>// Fixed by using pthread_once<br>void performWork() {<br>   pthread_once(&amp;once, init); // Correct<br>   pthread_mutex_lock(&amp;mutex);<br>   // ...<br>   pthread_mutex_unlock(&amp;mutex);<br>}</pre><h3>5) Thread leaks</h3><blockquote><em>Detects when you don’t close threads after use.</em></blockquote><p><strong>What does Tsan detect in this case?</strong></p><blockquote><em>// Lets creates a thread variable, but doesn’t close it after use:</em></blockquote><blockquote><em>// Tsan reports the issue that we have a thread leak, as shown below .</em></blockquote><pre>void *run(){<br>   pthread_exit(0);<br>}<br>pthread_t thread;<br>pthread_create(&amp;thread, NULL, run, NULL); // Error: thread leak<br>sleep(1);</pre><h3>Let’s fix this</h3><p>Add a call to the pthread_join(_:_:) function.</p><pre>void *run(){<br>   pthread_exit(0);<br>}<br>pthread_t thread;<br>pthread_create(&amp;thread, NULL, run, NULL);<br>sleep(1);</pre><pre>// Fix this issue by calling pthread_join<br>pthread_join(thread, NULL); // Correct</pre><h3>Awesome :)…… Now, I know all the issues that I can debug using Tsan,</h3><h3>Do we have anything else to learn, about TSan?</h3><blockquote><em>Yup little more left,</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*lZzum6WRoJcYgc-z.png" /></figure><h3>Let’s understand a little about TSan Build Flow, and how it actually works</h3><blockquote><strong><em>TSan Build Flow</em></strong></blockquote><blockquote>In order to use Thread Sanitizer, Xcode passes a <strong>special flags to both Clang and Swift compilers</strong> that instruct them to produce an instrumented binary. Below are the flags</blockquote><ul><li>-fsanitize=thread (clang)</li><li>-santize=thread (swiftc)</li><li>-enableThreadSanitizer YES (xcodebuild)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P-AWqvznwMWGZzWe.png" /></figure><blockquote>// This binary links to a TSan <strong>runtime library </strong>that is used by the instrumentation to both monitor the execution of the program and detect those threading issues.</blockquote><p><em>The compiler will add “</em>flags<em>” around each memory access to check whether certain access participates in a race</em></p><pre>func check_On_Two_Thread() {<br>        // Thread 1, Background Thread<br>        DispatchQueue.global().async {<br>            // Compiler adds a flag here, and keeps the eye<br>            // on the access participants, that leads to race<br>            print(self.testVariable)<br>        }<br>        <br>        // Thread 2,  Main Thread<br>        // Compiler will add flag here<br>        print(self.testVariable)<br>    }</pre><h3>There are restrictions on the Thread Sanitizer</h3><blockquote><em>You can’t use Thread Sanitizer to diagnose iOS, tvOS, and watchOS apps running on a device.</em></blockquote><blockquote><em>Use Thread Sanitizer only on your 64-bit macOS app, or to diagnose your 64-bit iOS, tvOS, or watchOS app running in Simulator.</em></blockquote><h3>What is the PERFORMANCE IMPACT?</h3><blockquote><em>Because Thread Sanitizer inserts diagnostics into your code, it increases memory usage by five to ten times. Running your code with these diagnostics also introduces a 2x to 20x slowdown of your app.</em></blockquote><blockquote><em>To improve your code’s memory usage, compile your code with the </em><em>-O1 optimization.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*pz7a7VWARHcBlV5m.jpeg" /></figure><h3>Yup, we are done.</h3><blockquote><em>That’s all, hope you liked it. Hopefully, you can catch bugs and fix some crashes that have been in your code for a long time.</em></blockquote><h3>To inspire me, to write more articles like this, kindly follow me</h3><blockquote><em>Kindly feel free to leave a comment or question. I will be really happy in receiving your feedback.</em></blockquote><blockquote>Have You Found It Useful? Comment IT</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9c673106b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Async /Await in Swift]]></title>
            <link>https://medium.com/@unleased_coder/async-await-in-swift-ed3f8cc64206?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed3f8cc64206</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[asyncawait]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 19:06:53 GMT</pubDate>
            <atom:updated>2023-11-04T19:11:05.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfxjcH1ExIzJchQNCMoCdA.png" /></figure><p>During WWDC21, Apple introduced the new <em>async/await</em> syntax into Swift version 5.5, allowing us to write asynchronous code in a shorter, more secure manner.</p><blockquote><em>We may use async/wait, for plenty of use cases only a few of them I have mentioned below.</em></blockquote><ol><li>When you have several serial API calls, means when you call the API one at a time in a specific order.</li><li>When an API output would be treated as an entry for other API calls.</li><li>Async can be used while handling read-only properties.</li><li>Async-await can be used for loops</li><li>Async/await sequences let us execute, cancel, and monitor concurrent operations in a structured way.</li><li>Using async let we can create await child tasks, This is helpful when you want tasks in a group to return different kinds of data.</li><li>The keyword <strong>Continuation</strong> allows us to create a shim between the completion handler and async functions so that we wrap up the older code in a more modern API, so Swift introduced new functions to help us adapt older, completion handler-style APIs to modern async code.</li><li>While working with asynchronous API calls, using @escaping closures. We can replace that by using the concept of async/await.</li></ol><p>Oh!</p><blockquote><em>Async tasks are already handled by existing APIs so what’s the need for Async/ Await?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wXWaFE2mtnWHBUWy" /></figure><blockquote><em>For small async task we use DispatchQueues</em></blockquote><blockquote><em>When we want to make one-by-one API calls, we may have to use Nested Closures or Dispatch groups</em></blockquote><blockquote><em>We use the concept of Operation Queue for any async image downloads.</em></blockquote><p><strong>We’ll take a look at a few issues with the existing Swift tools for Async</strong></p><blockquote><em>In order to figure out the issues we mentioned above, let’s write a simple example of nested closure.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AGRP6y5QCCzBOLkg" /></figure><ul><li>In the first place, compromise readability</li><li>And this code would be very difficult to maintain.</li><li>Callbacks make error handling difficult and very verbose</li><li>Conditionally executing an asynchronous function is a huge pain, suppose based on one condition you have to execute one closure, and for another, you don’t want to call that closure to get the final result.</li><li>Unknowingly, we would be creating strong references, potentially missing [weak self]</li><li>It’s quite easy to bail out of the asynchronous operation early by simply returning without calling the correct completion-handler block. When forgotten, the issue is very hard to debug:</li><li>We can use Dispatch group + Operation Queues, combination to manage the async programming, but that is always a tedious process to write all the boilerplate code and then customize it.</li></ul><p><strong>We have a solution for the above-stated problems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*b6PZWf81Jg80weGX" /></figure><p><strong>Apple’s Proposal: </strong><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md"><strong>SE-0296</strong></a><strong> to use Async/Await</strong></p><blockquote><em>Let’s try to modify the nested closure using async await</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FUNIBfFXvkk04OQZ" /></figure><p><em>Now, the code looks clean, also we are not compromising the maintainability and readability of the code. We could manage this code in a minimal amount of time</em></p><blockquote><strong><em>Let’s talk about few basic concepts</em></strong></blockquote><p>There are some straightforward, specific rules about the way async functions work:</p><blockquote><em>Synchronous functions cannot simply call async functions directly — it wouldn’t make sense, so Swift will throw an error.</em></blockquote><blockquote><em>Async functions can call another async function, but they can also call regular synchronous functions if they need to.</em></blockquote><blockquote><em>If you have async and synchronous functions that can be called in the same way, Swift will prefer whichever one matches your current context — if the call site is currently async then Swift will call the async function, otherwise it will call the synchronous function.</em></blockquote><blockquote><strong><em>Basics related to asynchronous function to understand the await keyword usage</em></strong></blockquote><p>Instead, think of an asynchronous function as an ordinary function that has the special power to give up its thread.</p><blockquote><em>Asynchronous functions don’t typically use this power directly; instead, they make calls, and sometimes these calls will require them to give up their thread and wait for something to happen. When that thing is complete, the function will resume executing again.</em></blockquote><blockquote><em>Asynchronous functions must be able to abandon their thread.</em></blockquote><blockquote><em>Whereas synchronous functions don’t know how to abandon a thread, a synchronous function can’t ordinarily call an asynchronous function:</em></blockquote><blockquote><em>The asynchronous function would only be able to give up the part of the thread it occupied, and if it tried, its synchronous caller would treat it like a return and try to pick up where it was, only without a return value.</em></blockquote><blockquote><em>An asynchronous function can call either synchronous or asynchronous functions.</em></blockquote><h3>Suspension points</h3><blockquote><em>The requirement for </em><strong><em>await</em></strong><em> on potential suspension points follows Swift’s precedent of requiring</em></blockquote><blockquote><em>A suspension point is a point in the execution of an asynchronous function where it has to give up its thread. Suspension points are always associated with some deterministic</em></blockquote><blockquote><em>The primary form of suspension point is a call to an asynchronous function associated with a different execution context.</em></blockquote><blockquote><strong><em>Let’s check out few more usage of Async/await:</em></strong></blockquote><ul><li><strong>Ability to loop over asynchronous sequences</strong></li></ul><blockquote><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0298-asyncsequence.md"><em>SE-0298</em></a><em> introduces the ability to loop over asynchronous sequences of values using a new </em><strong><em>AsyncSequence</em></strong><em> protocol. This is helpful for places when you want to process values in a sequence as they become available rather than precomputing them all at once</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i2X0lgGH5iC4kVdo" /></figure><ul><li><strong>Effectful read-only properties</strong></li></ul><blockquote><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0310-effectful-readonly-properties.md"><em>SE-0310</em></a><em> upgrades Swift’s read-only properties to support the </em><strong><em>async</em></strong><em> and </em><strong><em>throws</em></strong><em> keywords, either individually or together, making them significantly more flexible.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MOaDvyIvGUChtzSI" /></figure><ul><li><strong>API calling without using @escaping closures</strong></li></ul><blockquote><em>A lot of built-in SDK functions have been adapted to be async. For example URLSession comes with async functions to load or upload data</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x_p8Zt-sZr65gjtt" /></figure><blockquote><em>In the example above, we are using the data(from url: URL) async throws -&gt; (Data, URLResponse) method to load an image from a given image url.</em></blockquote><ul><li><strong>Writing async functions with continuation keyword</strong></li></ul><blockquote><em>To write our own async/await functions, Swift provides so called </em><strong><em>continuations</em></strong><em>. </em><strong><em>Continuation</em></strong><em> functions give us control over suspending and resuming the function.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TR_K8NJnGRgv-yxF.png" /></figure><blockquote><em>In the above example, we use an existing completion handler function to wrap it in a async function.</em></blockquote><blockquote><em>As soon as we call </em><strong><em>withCheckedContinuation(function:_:),</em></strong><em> the function suspends.</em></blockquote><blockquote><strong><em>Continuations</em></strong><em> must be resumed exactly once on every path. The compiler produces an error, if we forget to resume or call resume multiple times.</em></blockquote><blockquote><em>If the function needs to throw an error, we can use</em></blockquote><blockquote><strong><em>withCheckedThrowingContinuation(function:_:)</em></strong><em> instead.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/0*OOTKa0P5mnM5pc-e.jpeg" /></figure><blockquote><em>Have you any queries? comment on it.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed3f8cc64206" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lets’ talk about what is the difference between Any and AnyObject in Swift?]]></title>
            <link>https://medium.com/@unleased_coder/lets-talk-about-what-is-the-difference-between-any-and-anyobject-in-swift-1b423461906c?source=rss-ebcb9a1e858c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b423461906c</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[concepts-for-beginners]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Unleased_Coder]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 18:52:52 GMT</pubDate>
            <atom:updated>2023-11-04T18:52:52.869Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>ANY VS ANY OBJECT</strong></blockquote><p>Lets’ talk about what is the difference between Any and AnyObject in Swift?</p><p><strong>Any</strong></p><p>Any can represent an instance of any (class, struct, enum) type at all, including function types. In simple language we can say that Any can deal with both reference type as well as value type object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SyVIH-gOA_3cUG8Q.png" /></figure><p><strong>AnyObject</strong></p><ol><li>It refers to any instance of a class. It’s useful when you are working with reference type only. It’s equivalent to ‘id’ in Objective-C.</li><li>AnyObject can represent an instance of any class type<strong>.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eU3nE7WG8Gh-riQq.png" /></figure><p>Let see what happen when we try to add a string to this AnyObject array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZS-IHVcF_qNZg_J8.png" /></figure><h3>We have one more important use of AnyObject</h3><p>Replace all occurrences of class-only protocols from class to AnyObject and try to get used to a habit of using AnyObject from now on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*zr_EIJFEl8-06aBj.png" /></figure><p><strong>Apple proposal says that</strong></p><blockquote>The concepts of class and AnyObject, which now have the same meaning: they represent an existential for classes. To get rid of the duplication, we suggest only keeping AnyObject around. To reduce source-breakage to a minimum, class could be redefined as typealias class = AnyObject and give a deprecation warning on class for the first version of Swift this proposal is implemented in. Later, class could be removed in a subsequent version of Swift.<br>– <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0156-subclass-existentials.md">SE-0156 Class and Subtype existentials</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*WjtK-eT8Pr3eyPUw.png" /></figure><h3>History</h3><ol><li>In Swift 2 and earlier, importing to Swift from Objective-C had a problem</li><li>Swift 2 provided the implicit conversions to AnyObject for some bridged value types, such as String, Array, Dictionary, Set, and some numbers, as a convenience so that the native Swift types could be used easily with Cocoa APIs that expected NSString, NSArray, or the other container classes from Foundation</li><li><a href="https://developer.apple.com/swift/blog/?id=39">These conversions were inconsistent with the rest of the language, making it difficult to understand what exactly could be used as an AnyObject, resulting in bugs</a>.</li></ol><blockquote><em>Simply said, importing Objective-C’s id into Swift as AnyObject means you can’t benefit from value types in Swift and that’s where </em><strong><em>Any</em></strong><em> comes in.</em></blockquote><p>4. In Swift 3, Objective-C’s id is now imported as <strong>Any</strong> in Swift.</p><h3>We might have some issues while using Any and AnyObject</h3><ol><li>If we declare all the variables using <strong>Any</strong> or <strong>AnyObject</strong>, we are actually compromising the readability of the project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pGWigkKLFP2345qE.png" /></figure><p>2. Lets see one bye one</p><h3>Issues with Any</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lS6XegyaJdcS2Ryh.png" /></figure><p>In the above e.g we see that we have a variable who’s type can be changed at anytime in your project, and doing this can cause unexpected behaviour in the project.</p><h3>Issues with AnyObject</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LdoZy3fjYuaakrD_.png" /></figure><blockquote>The fix of the above issue, is that we have to typecast the objcBird to Bird class</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vpyiVOnZAWaepja_.png" /></figure><p>So the fix is definitely some extra work we have to do to access a simple property, which I am sure would be very easy if the objcBird would be declare as Bird class not as AnyObject.</p><h3>So when to choose Any or AnyObject</h3><ul><li>It’s a good practice to use <strong>AnyObject</strong> when working with <strong>classes</strong>, and <strong>Any</strong> when working with <strong>value</strong> types.</li></ul><blockquote><strong><em>Indeed, Apple recommends:</em></strong></blockquote><blockquote><em>Use </em><strong><em>Any</em></strong><em> and </em><strong><em>AnyObject</em></strong><em> only when you explicitly need the behaviour and capabilities they provide.</em></blockquote><blockquote><em>It is always better to be specific about the types you expect to work with in your code.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xQ7Ia4UKxuK9gYrG.png" /></figure><p><em>Have you any queries? comment on it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b423461906c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>