<?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 Raviraj Wadhwa on Medium]]></title>
        <description><![CDATA[Stories by Raviraj Wadhwa on Medium]]></description>
        <link>https://medium.com/@w.raviraj?source=rss-bd365efdbf95------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qQaCB3v5Iw7T5N_1mSCymw.png</url>
            <title>Stories by Raviraj Wadhwa on Medium</title>
            <link>https://medium.com/@w.raviraj?source=rss-bd365efdbf95------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:45:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@w.raviraj/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[Claude Code + Jira: How to Fix "mcp_enterprise_domain_mismatch" When Your Claude and Corporate…]]></title>
            <link>https://medium.com/@w.raviraj/claude-code-jira-how-to-fix-mcp-enterprise-domain-mismatch-when-your-claude-and-corporate-78062dbc9565?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/78062dbc9565</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[mcps]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 05:51:15 GMT</pubDate>
            <atom:updated>2026-07-24T05:51:15.615Z</atom:updated>
            <content:encoded><![CDATA[<h3>Claude Code + Jira: How to Fix &quot;mcp_enterprise_domain_mismatch&quot; When Your Claude and Corporate Accounts Are Different</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xm8ScJv-Vr6RaBa5sE68LQ.png" /></figure><h3>A simple step-by-step solution for developers who use their own Claude account but access a client’s Jira with a separate corporate account</h3><p>I recently faced an issue while trying to connect <strong>Atlassian/Jira with Claude Code</strong>.</p><p>The setup was quite common, especially if you are a contractor or work with a client using their own corporate accounts.</p><p>I had:</p><ul><li>My own <strong>Claude account</strong></li><li>A separate <strong>corporate email account provided by the client</strong></li><li>JIRA access through that corporate account</li></ul><p>For example:</p><pre>Claude account:<br>developer@personal.com<br><br>Client&#39;s Atlassian/Jira account:<br>developer@corporate.com</pre><p>I wanted Claude Code to read Jira tickets so that it could help me understand requirements while working on development tasks.</p><p>But connecting Jira through the normal Claude Atlassian connector did not work.</p><p>I kept getting this error:</p><pre>mcp_enterprise_domain_mismatch</pre><p>After trying a few things, I found a solution that worked.</p><p>The solution was to <strong>add Atlassian Remote MCP directly to Claude Code as a Local MCP</strong> instead of using the normal claude.ai Atlassian connector.</p><p>Here is the complete process.</p><h3>The Problem</h3><p>Let’s first understand the situation.</p><p>You may have your own Claude account:</p><pre>developer@personal.com</pre><p>But the company or client you are working for may have created another account for you:</p><pre>developer@corporate.com</pre><p>You use the corporate account to access things like:</p><ul><li>Jira</li><li>Confluence</li><li>Other Atlassian services</li></ul><p>But you continue using your own account for Claude Code.</p><p>So your setup looks something like this:</p><pre>Claude / Claude Code<br>developer@personal.com<br>        <br>        ↓<br><br>Atlassian / Jira<br>developer@corporate.com</pre><p>This is exactly the kind of setup I had.</p><h3>What Happened When I Connected Atlassian Normally</h3><p>Claude already provides an Atlassian connector.</p><p>You can find it under:</p><p><strong>Claude → Settings → Connectors → Atlassian</strong></p><p>I tried connecting my corporate Atlassian account from there.</p><p>The Atlassian login opened correctly.</p><p>I logged in using my corporate account and allowed Claude to access Jira.</p><p>But after that, instead of completing the connection, Claude showed this message:</p><blockquote><em>This corporate identity belongs to an enterprise that manages access through their own Claude account. Sign in to your organization’s Claude account to use this connection.</em></blockquote><p>The browser URL also contained:</p><pre>error_code=mcp_enterprise_domain_mismatch</pre><p>So the connection failed.</p><h3>Why Was This Happening?</h3><p>The important thing here is that there were <strong>two different accounts belonging to different organizations</strong>.</p><p>For example:</p><pre>My Claude account<br>developer@personal.com<br><br>↓<br><br>Trying to connect<br><br>↓<br><br>Client&#39;s Atlassian account<br>developer@corporate.com</pre><p>The corporate Atlassian account belongs to an organization that manages its own access.</p><p>But Claude was being used through another account.</p><p>Because of this, the normal Claude Atlassian connector could not complete the connection.</p><p>This is why I was seeing:</p><pre>mcp_enterprise_domain_mismatch</pre><p>At first, I thought there might be something wrong with:</p><ul><li>my Jira password</li><li>Jira permissions</li><li>Atlassian API access</li><li>Claude Code</li><li>or my Jira account</li></ul><p>But none of those was the actual problem.</p><p>My Jira account itself was working fine.</p><h3>The Solution That Worked</h3><p>Instead of using:</p><pre>claude.ai Atlassian CONNECTOR provided by Claude</pre><p>I added the <strong>Atlassian Remote MCP directly to Claude Code</strong>.</p><p>After doing this, Claude Code showed a separate Atlassian connection under:</p><pre>Local MCPs</pre><p>I authenticated that connection using my corporate Atlassian account.</p><p>And it worked.</p><p>The final setup looked like this:</p><pre>My Claude Code account<br>developer@personal.com<br><br>↓<br><br>Local MCP in Claude Code<br>atlassian<br><br>↓<br><br>Atlassian<br><br>↓<br><br>Corporate Jira account<br>developer@corporate.com<br><br>↓<br><br>Jira<br>✓ Connected</pre><p>Here are the exact steps.</p><h3>Step 1: Check Your Claude Code Version</h3><p>Open Terminal and run:</p><pre>claude --version</pre><p>Make sure you are using a recent version of Claude Code.</p><p>If your Claude Code installation is old, update it before continuing.</p><h3>Step 2: Open Your Project Directory</h3><p>Go to the project where you want to use Jira.</p><p>For example:</p><pre>cd ~/Workspace/my-project</pre><p>Use your actual project path here.</p><p>This is important because we are going to add Atlassian MCP for this project.</p><h3>Step 3: Add Atlassian MCP to Claude Code</h3><p>Run:</p><pre>claude mcp add --transport http atlassian https://mcp.atlassian.com/v1/mcp/auth</pre><p>You should see something similar to:</p><pre>Added HTTP MCP server atlassian with URL:<br>https://mcp.atlassian.com/v1/mcp/auth</pre><p>Claude may also tell you that it updated:</p><pre>~/.claude.json</pre><p>At this point, the Atlassian MCP has been added.</p><p>But there is one very important step before trying to use it.</p><h3>Step 4: Restart Claude Code</h3><p>This step was important in my case.</p><p>I added the MCP while Claude Code was already running.</p><p>The new Atlassian MCP did not immediately appear correctly in that running session.</p><p>So exit Claude Code:</p><pre>/exit</pre><p>Now make sure you are still inside your project directory:</p><pre>cd ~/Workspace/my-project</pre><p>Then start Claude Code again:</p><pre>claude</pre><h3>Step 5: Open the MCP List</h3><p>Inside Claude Code, run:</p><pre>/mcp</pre><p>Now you should see something similar to this:</p><pre>Local MCPs<br><br>atlassian ⚠ needs authentication<br><br>claude.ai<br><br>claude.ai Atlassian ⚠ needs authentication</pre><p>This is the most important part of the whole process.</p><p>There are now <strong>two Atlassian entries</strong>.</p><h3>One is:</h3><pre>claude.ai Atlassian</pre><p>This is the normal Claude connector.</p><p>This was the one that was giving me:</p><pre>mcp_enterprise_domain_mismatch</pre><h3>The other one is:</h3><pre>Local MCPs<br>→ atlassian</pre><p>This is the one we just added.</p><p><strong>Select this one.</strong></p><h3>Step 6: Authenticate the Local Atlassian MCP</h3><p>Select:</p><pre>Local MCPs<br>→ atlassian</pre><p>Press <strong>Enter</strong>.</p><p>Then choose:</p><pre>Authenticate</pre><p>Claude Code should open your browser.</p><p>You will now see the Atlassian authorization page.</p><h3>Step 7: Sign In With Your Corporate Atlassian Account</h3><p>This is where you should use the account that your client/company gave you.</p><p>For example:</p><pre>developer@corporate.com</pre><p>Not your personal Claude account.</p><p>Atlassian should show the Jira site that you have access to.</p><p>For example:</p><pre>yourcompany.atlassian.net</pre><p>You may also see permissions such as:</p><ul><li>Read</li><li>Search</li><li>Write</li></ul><p>Check the details and click:</p><p><strong>Accept</strong></p><h3>Step 8: Go Back to Claude Code</h3><p>After completing the Atlassian authorization, go back to Claude Code.</p><p>If everything worked, you should see:</p><pre>Authentication successful. Connected to atlassian.</pre><p>That’s it.</p><p>The connection is now working.</p><h3>Step 9: Test Jira From Claude Code</h3><p>Now try asking Claude Code to read a Jira ticket.</p><p>For example:</p><pre>Find Jira issue PROJECT-123 and summarize it.</pre><p>Or:</p><pre>Read Jira ticket PROJECT-123 and explain the requirements.</pre><p>Or:</p><pre>Find my recent Jira issues.</pre><p>If Claude returns information from your Jira, the setup is complete.</p><h3>What About claude.ai Atlassian?</h3><p>You may still see this when you run:</p><pre>/mcp</pre><p>For example:</p><pre>claude.ai Atlassian ⚠ needs authentication</pre><p>In my case, I simply ignored it.</p><p>I used:</p><pre>Local MCPs<br>→ atlassian</pre><p>That was the connection that worked.</p><p>So don’t get confused if you see two Atlassian entries.</p><p>For this setup, we want:</p><pre>Local MCPs<br><br>atlassian<br>✓ connected</pre><h3>If the Local MCP Does Not Appear</h3><p>If you run:</p><pre>/mcp</pre><p>and you only see:</p><pre>claude.ai Atlassian</pre><p>but don’t see:</p><pre>Local MCPs<br>→ atlassian</pre><p>first restart Claude Code.</p><p>Exit:</p><pre>/exit</pre><p>Go back to your project:</p><pre>cd ~/Workspace/my-project</pre><p>Start Claude Code again:</p><pre>claude</pre><p>Then run:</p><pre>/mcp</pre><p>again.</p><p>In my case, restarting Claude Code was necessary before the new Local MCP appeared.</p><h3>You Can Also Check the Configuration</h3><p>If you want to confirm that the MCP was added, you can check:</p><pre>~/.claude.json</pre><p>You should find an entry similar to:</p><pre>&quot;mcpServers&quot;: {<br>  &quot;atlassian&quot;: {<br>    &quot;type&quot;: &quot;http&quot;,<br>    &quot;url&quot;: &quot;https://mcp.atlassian.com/v1/mcp/auth&quot;<br>  }<br>}</pre><p>If you see this under your project, the MCP has been added.</p><h3>Final Thoughts</h3><p>This issue was confusing because both connections are called <strong>Atlassian</strong>.</p><p>At first, it looked like my corporate Jira account simply could not be connected to Claude Code because my Claude account used a different email.</p><p>But that wasn’t the end of the story.</p><p>The normal:</p><pre>claude.ai Atlassian</pre><p>connector did not work for my account setup.</p><p>Adding Atlassian directly to Claude Code gave me another option:</p><pre>Local MCPs<br>→ atlassian</pre><p>After restarting Claude Code and authenticating this Local MCP with my corporate Atlassian account, Jira connected successfully.</p><p>So if you are a developer, consultant, freelancer, or contractor who:</p><ul><li>uses your own Claude account,</li><li>has a separate corporate account provided by your client,</li><li>uses that corporate account for Jira,</li><li>and gets mcp_enterprise_domain_mismatch while connecting Atlassian,</li></ul><p><strong>try adding the Atlassian Remote MCP directly to Claude Code and authenticate the Local MCP instead.</strong></p><p>It worked for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78062dbc9565" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Potential of NFC in iOS Apps: A Comprehensive Guide to Reading and Writing NFC Tags]]></title>
            <link>https://medium.com/@w.raviraj/unlocking-the-potential-of-nfc-in-ios-apps-a-comprehensive-guide-to-reading-and-writing-nfc-tags-bb1ec4729916?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb1ec4729916</guid>
            <category><![CDATA[nfc]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[nfc-tags]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 07:33:47 GMT</pubDate>
            <atom:updated>2024-01-22T07:33:47.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRD1WV31HXXi51hnu5zCeg.jpeg" /></figure><h3>Introduction:</h3><p>In the rapidly advancing world of mobile technology, Near Field Communication (NFC) stands out as a powerful and versatile tool. This technology enables seamless communication between devices nearby, opening the door to a multitude of applications. In this blog post, we’ll explore the basics of NFC, delve into its real-world applications, and guide you through the process of implementing NFC functionality in your iOS app using Core NFC.</p><h3>Understanding NFC:</h3><p>NFC, Simplified: Near Field Communication (NFC) is a wireless communication technology that allows devices to exchange information when placed close together. Think of it as the magic behind contactless payments, secure access cards, and quick data transfers.</p><h3>Applications of NFC:</h3><ol><li><strong>Contactless Payments:</strong> Conveniently make payments with a simple tap of your smartphone or card.</li><li><strong>Access Control:</strong> Securely access buildings, offices, or public transportation with NFC cards.</li><li><strong>Information Transfer:</strong> Effortlessly transfer data between devices, enhancing user experience.</li><li><strong>Smart Posters:</strong> Interact with posters or advertisements containing NFC tags for additional information.</li><li><strong>Healthcare:</strong> Utilize NFC for patient identification, medical equipment tracking, and secure access.</li></ol><h3>How to Use Core NFC in Your iOS App:</h3><p>Now, let’s dive into a practical example of using Core NFC within a SwiftUI-based iOS app. In this example, we’ll create an app that can read and write contact information to and from NFC tags. The app will use the vCard format for simplicity.</p><blockquote>Please note that NFC operations, reading and writing from and to NFC tags, require a physical iOS device with NFC capabilities. The iOS simulator does not support NFC functionalities. Also especially for writing NFC tags, you’ll need a physical NFC tag. NFC tags come in various forms, such as cards, stickers, or key fobs. These tags contain an NFC chip that can store data. You can purchase NFC tags online or from local electronics retailers.</blockquote><h4>Enable NFC Capabilities:</h4><ul><li>Enable the “Near Field Communication Tag Reading” capability in your Xcode project.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQ3lmiQ7ldYLrZosPnh4Nw.gif" /></figure><h4>Creating a View:</h4><ul><li>Create a simple view with two buttons and a label.</li><li>A label is for displaying the read information from the NFC tag.</li><li>The two buttons are to begin reading and writing information from and into the NFC tag.</li></ul><pre>import SwiftUI<br>import CoreNFC<br><br>struct ContentView: View {<br>    @State private var nfcContent = &quot;&quot;<br>    @State private var isWriting = false<br><br>    var body: some View {<br>        VStack {<br>            Text(&quot;NFC Content: \(nfcContent)&quot;)<br>                .padding()<br><br>            Button(&quot;Read NFC&quot;) {<br>                startNFCReading()<br>            }<br>            .padding()<br><br>            Button(&quot;Write NFC&quot;) {<br>                startNFCWriting()<br>            }<br>            .padding()<br>            .disabled(isWriting)<br>        }<br>    }<br><br>    private func startNFCReading() {<br>        let nfcSession = NFCNDEFReaderSession(<br>            delegate: NFCReaderDelegate(<br>                contentCallback: { content in<br>                    DispatchQueue.main.async {<br>                        self.nfcContent = content<br>                        self.isWriting = false<br>                    }<br>                }<br>            ),<br>            queue: nil,<br>            invalidateAfterFirstRead: false<br>        )<br>        nfcSession.begin()<br>    }<br><br>    private func startNFCWriting() {<br>        isWriting = true<br><br>        let vCardPayload = &quot;&quot;&quot;<br>            BEGIN:VCARD<br>            FN:John Doe<br>            ORG:ABC Corporation<br>            TEL:+123456789<br>            EMAIL:john.doe@example.com<br>            END:VCARD<br>            &quot;&quot;&quot;<br>        <br>        let nfcSession = NFCNDEFReaderSession(<br>            delegate: NFCWriterDelegate(<br>                content: vCardPayload<br>            ),<br>            queue: nil,<br>            invalidateAfterFirstRead: false<br>        )<br>        nfcSession.begin()<br>    }<br>}</pre><h4>Conforming to read and write NFC delegates:</h4><pre>import CoreNFC<br><br>class NFCReaderDelegate: NSObject, NFCNDEFReaderSessionDelegate {<br>    private var contentCallback: ((String) -&gt; Void)?<br><br>    init(contentCallback: @escaping (String) -&gt; Void) {<br>        self.contentCallback = contentCallback<br>    }<br><br>    func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {<br>        for message in messages {<br>            for record in message.records {<br>                if let payloadString = String(data: record.payload, encoding: .utf8) {<br>                    contentCallback?(payloadString)<br>                }<br>            }<br>        }<br>    }<br><br>    func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {<br>        print(&quot;Error reading NFC: \(error.localizedDescription)&quot;)<br>    }<br>}<br><br>class NFCWriterDelegate: NSObject, NFCNDEFReaderSessionDelegate {<br>    private let content: String<br><br>    init(content: String) {<br>        self.content = content<br>    }<br><br>    func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {<br>        // Writing is not implemented for reader, but this method is required<br>    }<br><br>    func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {<br>        print(&quot;Error writing NFC: \(error.localizedDescription)&quot;)<br>    }<br><br>    func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) {<br>        // Implement writing functionality here if needed<br>        print(&quot;Writing NFC...&quot;)<br>    }<br>}</pre><h4>NFCReaderDelegate Class:</h4><p>This class acts as a delegate for the NFCNDEFReaderSession, which is responsible for reading NFC tags. Here&#39;s what each part does:</p><p>Initializer (init):</p><ul><li>The initializer takes a closure (contentCallback) as a parameter. This closure is a callback that will be called when NFC tags are successfully detected and their content is read.</li></ul><p>readerSession(_:didDetectNDEFs:) Method:</p><ul><li>This method is called when the NFC reader session detects NDEF (NFC Data Exchange Format) messages on a tag.</li><li>It iterates through each NDEF message and its records (individual pieces of data on the tag).</li><li>For each record, it attempts to convert the payload (the data on the tag) into a UTF-8 string (String(data:record.payload, encoding:.utf8)).</li><li>If the conversion is successful, it invokes the contentCallback closure, passing the payload string to it.</li></ul><p>readerSession(_:didInvalidateWithError:) Method:</p><ul><li>This method is called when the NFC reader session is invalidated, either due to an error or when the session is intentionally ended.</li><li>It prints an error message to the console if an error occurs during the NFC reading process.</li></ul><h4>NFCWriterDelegate Class:</h4><p>This class acts as a delegate for the NFCNDEFReaderSession, which, in this example, is intended to be used for writing to NFC tags. Here&#39;s what each part does:</p><p>Initializer (init):</p><ul><li>The initializer takes a content parameter, representing the content (payload) that will be written to the NFC tag.</li></ul><p>readerSession(_:didDetectNDEFs:) Method:</p><ul><li>This method is called when the NFC reader session detects NDEF messages on a tag.</li><li>It is intended for writing to NFC tags, but the writing functionality is not implemented in this example (hence the comment).</li><li>If writing functionality were implemented, it would be done within this method.</li></ul><p>readerSession(_:didInvalidateWithError:) Method:</p><ul><li>This method is called when the NFC reader session is invalidated, either due to an error or when the session is intentionally ended.</li><li>It prints an error message to the console if an error occurs during the NFC writing process.</li></ul><p>readerSessionDidBecomeActive(_:) Method:</p><ul><li>This method is called when the NFC reader session becomes active. It could be used to perform some tasks related to the writing process (not implemented in this example).</li><li>It prints a message to the console indicating that the NFC writing process is active.</li></ul><h4>Summary:</h4><ul><li>NFCReaderDelegate: Handles reading NFC tags, invokes a callback with the content when a tag is detected, and logs errors.</li><li>NFCWriterDelegate: Intended for writing to NFC tags (not fully implemented in this example), logs errors, and prints a message when the writing process becomes active.</li><li>These delegate classes are crucial for interacting with the Core NFC framework and responding to events during the NFC reading and writing processes.</li></ul><h3>In Conclusion:</h3><p>Implementing NFC functionality in your SwiftUI-based iOS app opens doors to a multitude of possibilities. From simplifying interactions to securing access, Core NFC empowers your app with seamless connectivity.</p><p><strong>Thank you for reading this guide! </strong>We hope it serves as a valuable resource as you explore the world of NFC in iOS development. If you have any questions or insights to share, feel free to connect. Happy coding! 🎉💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb1ec4729916" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using ChatGPT to Create Well-Defined JIRA Tickets]]></title>
            <link>https://medium.com/@w.raviraj/using-chatgpt-to-create-well-defined-jira-tickets-b9444c06c8bf?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9444c06c8bf</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[jira]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Tue, 17 Oct 2023 03:47:39 GMT</pubDate>
            <atom:updated>2023-10-18T13:35:40.875Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tE9ajgDStSpKwumis-eT3g.jpeg" /></figure><p>In the world of project management and software development, creating clear and comprehensive JIRA tickets is a crucial step towards achieving project success. A well-defined JIRA ticket provides a roadmap for teams, outlining tasks, requirements, and expectations. However, crafting these tickets can sometimes be a time-consuming and challenging task. But fear not, for we have a powerful ally in the form of ChatGPT, which can help streamline this process. In this article, we’ll explore how you can leverage ChatGPT to effortlessly create well-defined JIRA tickets.</p><h3>The Power of ChatGPT</h3><p>ChatGPT, a cutting-edge language model developed by OpenAI, can assist project managers, developers, and teams in generating precise and concise JIRA tickets. With ChatGPT’s natural language processing capabilities, you can easily communicate your project requirements and receive refined ticket descriptions and titles. Let’s walk through an example to see how it works.</p><h3>Example: Enhancing an iOS App</h3><p>Currently, we’re working on an iOS app, and we need to create a JIRA ticket to implement a new feature for displaying sales tax percentages and editing sales tax. Here’s how we can use ChatGPT to assist us:</p><h3>Step 1: Task Explanation</h3><p>Begin by providing ChatGPT with a clear and detailed explanation of the task you want to create a JIRA ticket for. Your explanation should include:</p><ul><li>A description of the current state of the app.</li><li>The specific changes required.</li><li>Any design or UI details.</li><li>Any additional functionality or user flows.</li></ul><h3>Step 2: Request Ticket Details</h3><p>Once ChatGPT has a clear understanding of your task, ask it to provide you with an appropriate title and a well-defined description for the JIRA ticket.</p><p>In our case, we want to enhance the app’s pre-order screen to display the tax percentage and enable users to edit it.</p><p>So we have structured our request like this:</p><pre>I want to create a JIRA ticket for a task for my iOS app.<br>I want you to provide me appropriate title.<br>I want you to provide me a well-defined description along with design links.<br>The task details and links are explained below.<br><br>- My iOS app has a pre-order screen.<br>- The pre-order screen contains a price summary section.<br>- In a price summary section we show sales tax amounts; like this: &quot;Tax  99.00 USD&quot;<br>- Now we need to calculate and show how much % tax is applied; like this: &quot;Tax (25 %) 99.00 USD&quot;<br>- Tax % calculation needs to be done on the app side using the total amount and tax amount provided by the backend.<br>- Also we need to show the edit pencil icon/button beside &quot;Tax (25 %)&quot;<br>- Design for updated pre-order screen: https://www.figma.com<br>- Tapping on the edit tax button will initiate the edit sales tax percentage flow.<br>- The first this will happen is an alert will be shown.<br>- Alert will have the following text and yes and no buttons.<br>- Are you sure you want to edit the sales tax as this might have some implications from the tax authority?<br>- Alert design: https://www.figma.com<br>- Tapping on the No button on the alert will dismiss the alert/<br>- Tapping on the yes button on the alert will dismiss the alert and will navigate from pre-order screen to a new screen to edit the tax percentage<br>- New edit tax screen design: https://www.figma.com<br>- This new edit tax screen has a &quot;New tax&quot; text field and an &quot;Update tax&quot; button.<br>- The &quot;update tax&quot; button is disabled initially<br>- It gets enabled only after entering a value in the &quot;new tax&quot; text field<br>- Tapping on the &quot;update tax&quot; button makes a request to the backend to update tax and shows a loader while the request is in progress.<br>- The loader design is as follows: https://www.figma.com<br>- After the request is done loader gets hidden and we show either an error alert or a success alert.<br>- Error alert design: https://www.figma.com<br>- Success alert design: https://www.figma.com<br>- Tapping on the Close button on the error alert dismisses the error alert<br>- Tapping on the OKay button on the success alert dismisses the error alert and navigates back to the pre-order screen.<br>- On coming back to the pre-order screen, pre-order details are fetched again to get the new tax amount, which automatically updates the price summary in the pre-order screen.</pre><h3>Step 3: Use Result to Create JIRA Ticket</h3><p>As you can see the results are amazing. All we now need to do is copy-paste the results and create our JIRA ticket.</p><pre><br>**Title:**<br>Implement Sales Tax Percentage Display and Edit Functionality<br><br>**Description:**<br>**Task Details:**<br><br>Our iOS app currently features a pre-order screen that includes a price summary section. Within this price summary section, we display sales tax amounts in the following format: &quot;Tax 99.00 USD.&quot; We now need to enhance this section to include the percentage of tax applied, like this: &quot;Tax (25 %) 99.00 USD.&quot; This percentage calculation should be done within the app itself, utilizing the total amount and tax amount provided by the backend.<br><br>**Design Links:**<br>- Updated Pre-order Screen Design: [Figma Link](https://www.figma.com)<br><br>**Additional Functionality:**<br><br>1. A clickable edit pencil icon/button must be added next to &quot;Tax (25 %).&quot;<br><br>2. Tapping on the edit tax button should initiate the sales tax percentage editing flow. This begins with the display of an alert containing the following text and &quot;Yes&quot; and &quot;No&quot; buttons:<br>   <br>   &quot;Are you sure you want to edit the sales tax percentage, as this may have implications from the tax authority?&quot;<br><br>   **Alert Design:** [Figma Link](https://www.figma.com)<br><br>3. Selecting &quot;No&quot; on the alert should dismiss it, while selecting &quot;Yes&quot; should dismiss the alert and navigate to a new screen for editing the tax percentage.<br><br>4. The new edit tax screen should include a &quot;New tax&quot; text field and an initially disabled &quot;Update tax&quot; button. The button becomes enabled only after a value is entered in the &quot;New tax&quot; text field.<br><br>5. Tapping on the &quot;Update tax&quot; button initiates a request to the backend to update the tax percentage and displays a loader while the request is in progress.<br><br>   **Loader Design:** [Figma Link](https://www.figma.com)<br><br>6. After the request is completed, the loader is hidden, and either an error alert or a success alert is displayed, depending on the outcome.<br><br>   **Error Alert Design:** [Figma Link](https://www.figma.com)<br><br>   **Success Alert Design:** [Figma Link](https://www.figma.com)<br><br>7. Tapping the &quot;Close&quot; button on the error alert should dismiss it, and tapping &quot;OK&quot; on the success alert should dismiss it and navigate back to the pre-order screen.<br><br>8. Upon returning to the pre-order screen, retrieve pre-order details to obtain the new tax amount, which should automatically update the price summary.</pre><h3>Conclusion</h3><p>Now, with your well-defined JIRA ticket in hand, you can seamlessly communicate your project requirements to your team, ensuring a smoother development process and better project outcomes. Harness the power of ChatGPT to simplify your project management tasks and keep your projects on track.</p><h3>Thanks 🙏</h3><p>Thank you for exploring the possibilities of ChatGPT in enhancing your project management workflow. May your JIRA tickets be clear, and concise, and your projects a resounding success!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9444c06c8bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing SwiftUI’s ContentUnavailableView]]></title>
            <link>https://medium.com/@w.raviraj/introducing-swiftuis-contentunavailableview-98e2248cfba8?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/98e2248cfba8</guid>
            <category><![CDATA[swi̇ft]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios-17]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 06:29:55 GMT</pubDate>
            <atom:updated>2023-08-24T06:29:55.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VS76zdSCzoZ-jEE-uGLIng.png" /></figure><p>With the advent of iOS 17, SwiftUI has introduced a new feature: <em>ContentUnavailableView</em>. This specialized view is designed to elegantly handle scenarios where your app’s content cannot be displayed.</p><h4>Understanding When to Use ContentUnavailableView:</h4><p>As the name suggests, <em>ContentUnavailableView</em> should be employed when your view’s content cannot be shown due to various reasons, such as network errors, an empty list, or a search yielding no results.</p><h4>How to Implement ContentUnavailableView:</h4><p>There are three primary ways to utilize ContentUnavailableView:</p><ol><li>Built-in Unavailable Views.</li><li>Custom Unavailable Views.</li><li>Unavailable Views with Actions:</li></ol><h4>Built-in Unavailable Views:</h4><p>Out of the box, <em>ContentUnavailableView</em> provides support for only one scenario: an empty search result. You can effortlessly present an empty search result view using <em>ContentUnavailableView.search</em>, complete with a magnifying glass image, a <em>“No results”</em> label, and helpful instructions for obtaining a valid search result.</p><pre>struct ContentView: View {<br>    var body: some View {<br>        ContentUnavailableView.search<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVF9RkBONNeSvNaW7iC8lQ.png" /></figure><p>Additionally, you can create an empty search view with a specified search query to provide users with more context.</p><pre>struct ContentView: View {<br>    var body: some View {<br>        ContentUnavailableView<br>            .search(text: &quot;Beds&quot;)<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4SNculkhfA3acXe50YsQg.png" /></figure><h4>Custom Unavailable Views:</h4><p>If you wish to use <em>ContentUnavailableView</em> for scenarios other than search, you can easily do so by utilizing other initializers that accept:</p><ul><li>Label</li><li>Image</li><li>Description</li></ul><p>For example, here’s how you can create an empty view for a network error:</p><pre>ContentUnavailableView(<br>    &quot;No Internet&quot;,<br>    systemImage: &quot;wifi.exclamationmark&quot;,<br>    description: Text(&quot;Try checking the network cables, modem, and router or reconnecting to Wi-Fi.&quot;)<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0FDEvkNTnPZ9YfsMe9A_AA.png" /></figure><h4>Unavailable Views with Actions:</h4><p>The most versatile way to create an unavailable view is by utilizing an initializer that allows you to inject three @ViewBuilder closures:</p><ul><li>label (used for the title and image)</li><li>description (used for content)</li><li>actions (provides extra actions, such as action buttons)</li></ul><p>Here’s an example that includes an action button, directing users to another view:</p><pre>ContentUnavailableView {<br>    Label(&quot;Empty Bookmarks&quot;, systemImage: &quot;bookmark&quot;)<br>} description: {<br>    Text(&quot;Explore a great movie and bookmark the one you love to enjoy later.&quot;)<br>} actions: {<br>    Button(&quot;Browse Movies&quot;) {<br>        // Go to the movie list.<br>    }<br>    .buttonStyle(.borderedProminent)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Csr9dGqHivBVjy1gRNsA_Q.png" /></figure><h4>Benefits of ContentUnavailableView</h4><p>While it’s possible to achieve similar results using <em>VStack</em> and <em>Text</em>, <em>ContentUnavailableView</em> offers significant time savings for handling repetitive tasks. Furthermore, it ensures a consistent and appealing appearance across different platforms.</p><p>As seen in examples on Apple Watch and for views with lengthy content, <em>ContentUnavailableView</em> adapts intelligently by hiding images on Apple Watch to save space and making sure that scrollable content remains scrollable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*Zq3q-LFoRWkzGV4wLcon4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*ude1HKRltdGqKv8fEEy7Kw.gif" /></figure><p><strong><em>Thank you</em></strong><em> 🙏 for taking the time to read this article! Your interest is greatly appreciated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98e2248cfba8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Generics in Swift: Advanced Concepts and Examples]]></title>
            <link>https://medium.com/@w.raviraj/mastering-generics-in-swift-advanced-concepts-and-examples-85d5cfe11dca?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/85d5cfe11dca</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[generics]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Mon, 26 Jun 2023 15:38:01 GMT</pubDate>
            <atom:updated>2023-06-26T15:38:01.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*NN0hewDGR6-898tQHAKZWA.png" /></figure><h4>Introduction:</h4><p>Generics in Swift offer developers a powerful toolset for writing flexible and reusable code. Building upon the basics, <em>(TODO: Add a link to beginners article)</em> this article delves into advanced concepts and examples to help you master the art of leveraging generics in Swift. We will explore topics such as associated types, generic protocols, and advanced type constraints, empowering you to take your coding skills to the next level.</p><h4>Associated Types:</h4><p>Associated types allow us to define generic protocols that can work with different types in a flexible manner. By associating a type with a protocol, we can leave the actual type implementation to conforming types. Let’s dive into an example.</p><p>Example 1: Associated Type in a Protocol</p><pre>protocol Container {<br>    associatedtype Item<br>    var count: Int { get }<br>    mutating func append(_ item: Item)<br>    subscript(i: Int) -&gt; Item { get }<br>}<br><br>struct Stack&lt;T&gt;: Container {<br>    var items = [T]()<br>    <br>    mutating func push(_ item: T) {<br>        items.append(item)<br>    }<br>    <br>    mutating func pop() -&gt; T {<br>        return items.removeLast()<br>    }<br>    <br>    // Container Protocol Conformance<br>    typealias Item = T<br>    var count: Int {<br>        return items.count<br>    }<br>    <br>    mutating func append(_ item: T) {<br>        push(item)<br>    }<br>    <br>    subscript(i: Int) -&gt; T {<br>        return items[i]<br>    }<br>}<br><br>var stack = Stack&lt;Int&gt;()<br>stack.append(1)<br>stack.append(2)<br>stack.append(3)<br>print(stack[0]) // Output: 1<br>print(stack.count) // Output: 3</pre><p>In the above example, we define a protocol <strong><em>Container</em></strong> with an associated type <strong><em>Item</em></strong>. The <strong><em>Container</em></strong> protocol provides a blueprint for a generic container type. We then implement the <strong><em>Stack</em></strong> structure, which conforms to the <strong><em>Container</em></strong> protocol by associating its generic type <strong><em>T</em></strong> with the associated type <strong><em>Item</em></strong>. This allows us to create a stack of any type and fulfil the requirements of the <strong><em>Container</em></strong> protocol.</p><h4>Generic Where Clauses:</h4><p>Generic where clauses allow us to add additional constraints to type parameters in generic functions and extensions. They provide more fine-grained control over type constraints, enabling us to express complex requirements.</p><p>Example 2: Generic Where Clause</p><pre>func allItemsMatch&lt;C1: Container, C2: Container&gt;(_ container1: C1, _ container2: C2) -&gt; Bool<br>    where C1.Item == C2.Item, C1.Item: Equatable</pre><p>This function takes two containers and checks if all the items in the containers match each other. Let’s break down the generic where clauses used in this function:</p><ol><li>C1: Container, C2: Container: This part of the clause specifies that C1 and C2 must be types that conform to the Container protocol. It ensures that the function can only be called with containers that have the required capabilities (append(_:), count, and subscript) defined in the Container protocol.</li><li>C1.Item == C2.Item: This clause states that the associated type Item of C1 must be the same as the associated type Item of C2. It ensures that both containers contain items of the same type.</li><li>C1.Item: Equatable: This clause specifies that the associated type Item of C1 must conform to the Equatable protocol. It allows the function to compare the items for equality using the == operator.</li></ol><p>With these generic where clauses, the function allItemsMatch(_:_:) can only be called with two containers (C1 and C2) that conform to the Container protocol, have the same associated type for Item, and have items that are Equatable. This provides compile-time safety and ensures that the function can only operate on compatible containers.</p><h4>Advanced Generic Constraints:</h4><p>Swift allows us to apply more advanced constraints to generic types, including class and protocol composition constraints. These constraints allow us to specify that a generic type parameter must inherit from a specific class or conform to multiple protocols.</p><p>Example 3: Class and Protocol Composition Constraints</p><pre>protocol Printable {<br>    func printDescription()<br>}<br><br>class Vehicle {<br>    var manufacturer: String<br>    <br>    init(manufacturer: String) {<br>        self.manufacturer = manufacturer<br>    }<br>}<br><br>class Car: Vehicle, Printable {<br>    var model: String<br>    <br>    init(manufacturer: String, model: String) {<br>        self.model = model<br>        super.init(manufacturer: manufacturer)<br>    }<br>    <br>    func printDescription() {<br>        print(&quot;Car: \(manufacturer), \(model)&quot;)<br>    }<br>}<br><br>func printVehicleDescription&lt;T: Vehicle &amp; Printable&gt;(_ vehicle: T) {<br>    vehicle.printDescription()<br>}<br><br>let myCar = Car(manufacturer: &quot;Tesla&quot;, model: &quot;Model 3&quot;)<br>printVehicleDescription(myCar) // Output: Car: Tesla, Model 3</pre><p>In this example, we define a protocol <strong><em>Printable</em></strong> and a class <strong><em>Vehicle</em></strong>. The class <strong><em>Car</em></strong> inherits from <strong><em>Vehicle</em></strong> and conforms to <strong><em>Printable</em></strong>. We then create a generic function <strong><em>printVehicleDescription</em></strong> that takes a type parameter <strong><em>T</em></strong> constrained to both <strong><em>Vehicle</em></strong> and <strong><em>Printable</em></strong>. This ensures that the function can only be called with types that satisfy both constraints.</p><h4>Conclusion:</h4><p>Congratulations! You have explored advanced concepts of generics in Swift, including associated types, generic where clauses, and advanced generic constraints. By mastering these concepts, you can design highly flexible and reusable code that adapts to various types and requirements. Generics empower you to write concise, efficient, and type-safe code, enhancing the maintainability and scalability of your Swift projects. With the knowledge gained from this article, you are well-equipped to leverage the full potential of generics and elevate your programming skills to new heights.</p><p><em>Thanks 🙏☺️ for your time and stay tuned for more iOS, Swift and SwiftUI concepts…</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85d5cfe11dca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Generics in Swift: Simplifying Code for Beginners]]></title>
            <link>https://medium.com/@w.raviraj/an-introduction-to-generics-in-swift-simplifying-code-for-beginners-1b48792124c5?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b48792124c5</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[generics-swift]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 06:12:20 GMT</pubDate>
            <atom:updated>2023-06-13T06:12:20.172Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*NN0hewDGR6-898tQHAKZWA.png" /></figure><h4>Introduction:</h4><p>Swift, Apple’s powerful and intuitive programming language, offers a variety of features that enhance code reusability and maintainability. One such feature is generics. Generics allow us to write flexible and reusable code by defining functions, classes, and structures that can work with any type. In this article, we will explore the fundamentals of generics in Swift, providing clear examples and explanations to help beginners grasp this important concept.</p><h4>Understanding Generics:</h4><p>Generics in Swift enable developers to create functions and data types that can work with various types without sacrificing type safety. This means we can write code that is more versatile and reusable, saving time and effort in the long run.</p><h4>The Benefits of Generics:</h4><p>Before diving into the specifics, let’s discuss the advantages of using generics in Swift:</p><ol><li>Reusability: Generics promote code reusability by allowing us to write functions and data types that work with different types. This eliminates the need to duplicate code for each specific type.</li><li>Type Safety: Swift’s static typing ensures type safety, even with generics. The compiler enforces type constraints, reducing the chances of runtime errors and improving code reliability.</li><li>Abstraction: Generics provide a level of abstraction that enables developers to write flexible and generic algorithms. This abstraction allows us to focus on the core functionality rather than worrying about specific data types.</li></ol><h4>Generic Functions:</h4><p>Let’s start by exploring generic functions. A generic function is defined using angle brackets (&lt; and &gt;) and a placeholder type parameter.</p><p>Example 1: Swapping Two Values</p><pre>func swap&lt;T&gt;(_ a: inout T, _ b: inout T) {<br>    let temp = a<br>    a = b<br>    b = temp<br>}<br><br>var x = 5<br>var y = 10<br>swap(&amp;x, &amp;y)<br>print(&quot;x =&quot;, x, &quot;y =&quot;, y) // Output: x = 10, y = 5<br><br>var str1 = &quot;Hello&quot;<br>var str2 = &quot;World&quot;<br>swap(&amp;str1, &amp;str2)<br>print(&quot;str1 =&quot;, str1, &quot;str2 =&quot;, str2) // Output: str1 = World, str2 = Hello</pre><p>In the above example, the swap function uses a generic type parameter T to swap two values of any type. The function takes two inout parameters, a and b, and swaps their values using a temporary variable.</p><h4>Generic Types:</h4><p>Generics can also be applied to custom data types, such as classes, structures, and enums. Let’s look at an example of a generic stack data structure.</p><p>Example 2: Generic Stack</p><pre>struct Stack&lt;Element&gt; {<br>    private var elements = [Element]()<br>    <br>    mutating func push(_ element: Element) {<br>        elements.append(element)<br>    }<br>    <br>    mutating func pop() -&gt; Element? {<br>        return elements.popLast()<br>    }<br>    <br>    func peek() -&gt; Element? {<br>        return elements.last<br>    }<br>    <br>    var isEmpty: Bool {<br>        return elements.isEmpty<br>    }<br>    <br>    var count: Int {<br>        return elements.count<br>    }<br>}<br><br>// Usage<br>var intStack = Stack&lt;Int&gt;()<br>intStack.push(1)<br>intStack.push(2)<br>intStack.push(3)<br>print(intStack.pop()) // Output: Optional(3)<br><br>var stringStack = Stack&lt;String&gt;()<br>stringStack.push(&quot;Hello&quot;)<br>stringStack.push(&quot;World&quot;)<br>print(stringStack.peek()) // Output: Optional(&quot;World&quot;)</pre><p>In this example, we define a generic Stack structure that can store elements of any type. The type parameter Element is used to represent the type of elements stored in the stack. We can create multiple instances of the Stack structure with different element types, such as Int and String.</p><h4>Type Constraints:</h4><p>Swift allows us to apply constraints to generic type parameters, specifying that they must conform to certain protocols or inherit from specific classes.</p><p>Example 3: Constrained Generic Function</p><pre>func processArray&lt;T: Numeric&gt;(_ array: [T]) -&gt; T {<br>    var result: T = 0<br>    for element in array {<br>        result += element<br>    }<br>    return result<br>}<br><br>let numbers = [1, 2, 3, 4, 5]<br>let sum = processArray(numbers)<br>print(&quot;Sum:&quot;, sum) // Output: Sum: 15</pre><p>In the above example, the processArray function takes an array of type T, constrained to conform to the Numeric protocol. This constraint ensures that the elements in the array can be added together using the += operator.</p><h4>Conclusion:</h4><p>Generics are a powerful feature in Swift that enables us to write flexible, reusable, and type-safe code. By leveraging generics, we can create functions and data types that work with different types, enhancing code reusability and maintainability. We’ve explored generic functions, generic types, and type constraints, providing beginners with a solid foundation to begin utilizing generics in their Swift projects. With practice and further exploration, developers can unlock the full potential of generics and streamline their coding efforts.</p><p><em>Thanks </em>☺️🙏<em> for your time and stay tuned for the advanced generics article…</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b48792124c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architecting a Code to Create Different Types of URLRequest]]></title>
            <link>https://medium.com/@w.raviraj/architecting-a-code-to-create-different-types-of-urlrequest-27910b564e9f?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/27910b564e9f</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[url]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Thu, 01 Jun 2023 11:34:07 GMT</pubDate>
            <atom:updated>2023-06-01T11:34:07.563Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jIKtHCa6XvOLIUe233GiyA.png" /></figure><h4>Introduction:</h4><p>In every app, we often need to make various API calls, each with its unique requirements. These calls involve creating different <strong><em>URLRequest</em></strong>s. The URL paths, HTTP methods, and data passed in these requests can vary. To simplify the process of creating requests, let’s structure our code in a way that allows for easy request creation.</p><h4>Example: Handling Employee-related Data</h4><p>Let’s consider an app that deals with employee data. This app needs to make several API calls to perform actions such as retrieving all employees, fetching a specific employee, creating a new employee, updating employee details, deleting an employee, and searching for employees. To handle these different types of calls, we’ll start by creating an enum representing the various API requests.</p><pre>typealias EmployeeId = Int<br>typealias EmployeeName = String<br>typealias EmployeeSalary = Double<br>typealias EmployeeAge = Int<br><br>// MARK: - Employee<br><br>struct Employee: Codable {<br>    // Employee properties<br>    let name: String?<br>    let salary: Double?<br>    let age: Int?<br>    let id: Int?<br><br>    enum CodingKeys: String, CodingKey {<br>        case name = &quot;name&quot;<br>        case salary = &quot;salary&quot;<br>        case age = &quot;age&quot;<br>        case id = &quot;id&quot;<br>    }<br>}<br><br>// MARK: - Enum<br><br>enum EmployeeRequests {<br>    case getAllEmployees<br>    case getEmployee(EmployeeId)<br>    case createEmployee(Employee)<br>    case updateEmployee(EmployeeId, Employee)<br>    case deleteEmployee(EmployeeId)<br>    case searchEmployees(EmployeeName?, EmployeeSalary?, EmployeeAge?)<br>}</pre><p>In this code snippet, note the following points:</p><ol><li>Each enum case represents a different API request, with varying inputs.</li><li>Typealiases are used to make the input requirements self-explanatory.</li><li>The basic idea is to categorize different sets of requests using enums. Similarly, for requests related to orders, customers, or users, we would create separate enums.</li></ol><h4>Creating URLRequestCreator Protocol:</h4><p>Now whenever we need to make a call we need to create a request and we will create a request like this.</p><pre>let request = EmployeeRequests.getAllEmployees.create</pre><p>However, currently, the compiler throws an error because the member function is not yet implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDlxNFxsBjdyBOyik62K_Q.png" /></figure><p>To resolve this, we need to define a member function called create within our enum. We&#39;ll begin by creating a protocol called URLRequestCreator.</p><pre>protocol URLRequestCreator {<br><br>    associatedtype BodyObject: Encodable<br><br>    var baseUrlString: String { get }<br>    var apiPath: String? { get }<br>    var apiVersion: String? { get }<br>    var endPoint: String? { get }<br>    var queryString: String? { get }<br>    var queryItems: [URLQueryItem]? { get }<br>    var method: HTTPRequestMethod { get }<br>    var headers: [String: String]? { get }<br>    var bodyParameters: [String: Any]? { get }<br>    var bodyObject: BodyObject? { get }<br><br>}<br><br>extension URLRequestCreator {<br><br>    func create() throws -&gt; URLRequest {<br><br>        guard var urlComponents = URLComponents(string: baseUrlString) else {<br>            throw URLRequestCreatorError.failedToCreateURLComponents<br>        }<br><br>        var fullPath = &quot;&quot;<br><br>        if let apiPath {<br>            fullPath += &quot;/&quot; + apiPath<br>        }<br><br>        if let apiVersion {<br>            fullPath += &quot;/&quot; + apiVersion<br>        }<br><br>        if let endPoint {<br>            fullPath += &quot;/&quot; + endPoint<br>        }<br><br>        if let queryString {<br>            fullPath += &quot;/&quot; + queryString<br>        }<br><br>        urlComponents.path = fullPath<br><br>        urlComponents.queryItems = queryItems<br><br>        guard let url = urlComponents.url else {<br>            throw URLRequestCreatorError.failedToGetURLFromURLComponents<br>        }<br>        var request = URLRequest(url: url)<br>        request.httpMethod = method.rawValue<br><br>        if let headers {<br>            for header in headers {<br>                request.addValue(header.value, forHTTPHeaderField: header.key)<br>            }<br>        }<br><br>        let jsonData = try? JSONEncoder().encode(bodyObject)<br>        request.httpBody = jsonData<br><br>        return request<br><br>    }<br><br>}<br><br>enum URLRequestCreatorError: Error {<br>    case failedToCreateURLComponents<br>    case failedToGetURLFromURLComponents<br>}</pre><p>This protocol defines the required information for creating a URLRequest, such as the base URL, path, HTTP method, headers, and body. The create method concatenates the provided information to construct the URLRequest.</p><p>Our protocol is designed in a way — that whoever adopts it will need to provide this info and then the common create method will concatenate all the info provided to create a URLRequest.</p><blockquote>Note that:</blockquote><blockquote>1. Apart from baseUrlString everything else is optional. Because not all APIs will have the same level of path or query attached to it or body attached to it or headers.</blockquote><blockquote>2. In create method we are making sure if the particular info is available or not. Appending it into the request only if it is available.</blockquote><blockquote>3. The create method can throw an error. If we are passing valid info then it won&#39;t throw an error but in case by mistake we passed incorrect values it will throw an error and help us in pointing out the issue.</blockquote><blockquote>4. We have a generic <strong>associatedtype</strong> BodyObject: Encodable. The reason we are using genric type here is that some EmployeeRequests need to pass value of type Employee. But this protocol can be adopted by various requuest and they might need to pass value of some other type. e.g. OrderRequests might need to pass value of type Order.</blockquote><blockquote>5. You might also be wondering why we don’t have a create function inside the protocol itself. Why we have written it in a separate extension? Well, that is because protocol just holds the methods or properties declaration, not their actual body. If we try to write create method inside protocol then we will get a compiler error: Protocol methods must not have bodies. However, through extension, we can extend a protocol and add common methods to it which can be called by any instance adopting the protocol.</blockquote><h4>Implementing the URLRequestCreator Protocol:</h4><p>We’ll now implement the URLRequestCreator protocol in our EmployeeRequests enum. By adopting this protocol, we&#39;ll be able to create requests easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vs0XLBsC7FZMPvv4Qb-kbQ.gif" /></figure><p>As you can see as soon as the EmployeeRequests adopts the protocol URLRequestCreator the compiler throws an error and tells us to add the protocol stubs. That is define the properties declared in the protocol. That is provide the values required by the protocol.</p><p>So the next point is now to provide the info/values required to create requests.</p><pre>extension EmployeeRequests: URLRequestCreator {<br>    typealias BodyObject = Employee<br><br>    var baseUrlString: String {<br>        &quot;https://dummy.restapiexample.com&quot;<br>    }<br><br>    // Define other properties required for creating URLRequest<br><br>    var apiPath: String? {<br>        &quot;api&quot;<br>    }<br><br>    var apiVersion: String? {<br>        &quot;v1&quot;<br>    }<br><br>    var endPoint: String? {<br>        switch self {<br>        case .getAllEmployees:<br>            return &quot;employees&quot;<br>        case .getEmployee:<br>            return &quot;employee&quot;<br>        case .createEmployee:<br>            return &quot;create&quot;<br>        case .updateEmployee:<br>            return &quot;update&quot;<br>        case .deleteEmployee:<br>            return &quot;delete&quot;<br>        case .searchEmployees:<br>            return &quot;search&quot;<br>        }<br>    }<br><br>    var queryString: String? {<br>        switch self {<br>        case .getEmployee(let employeeId), .updateEmployee(let employeeId, _), .deleteEmployee(let employeeId):<br>            return String(employeeId)<br>        default:<br>            return nil<br>        }<br>    }<br><br>    var queryItems: [URLQueryItem]? {<br>        switch self {<br>        case .searchEmployees(let employeeName, let employeeSalary, let employeeAge):<br>            var queryItems = [URLQueryItem]()<br>            if let employeeName {<br>                queryItems.append(URLQueryItem(name: &quot;name&quot;, value: employeeName))<br>            }<br>            if let employeeSalary {<br>                queryItems.append(URLQueryItem(name: &quot;salary&quot;, value: String(employeeSalary)))<br>            }<br>            if let employeeAge {<br>                queryItems.append(URLQueryItem(name: &quot;age&quot;, value: String(employeeAge)))<br>            }<br>            return queryItems<br>        default:<br>            return nil<br>        }<br>    }<br><br>    var method: HTTPRequestMethod {<br>        switch self {<br>        case .getAllEmployees:<br>            return .GET<br>        case .getEmployee:<br>            return .GET<br>        case .createEmployee:<br>            return .POST<br>        case .updateEmployee:<br>            return .PUT<br>        case .deleteEmployee:<br>            return .DELETE<br>        case .searchEmployees:<br>            return .GET<br>        }<br>    }<br><br>    var headers: [String: String]? {<br>        switch self {<br>        case .createEmployee, .updateEmployee:<br>            return [&quot;Content-Type&quot;: &quot;application/json&quot;]<br>        default:<br>            return nil<br>        }<br>    }<br><br>    var bodyParameters: [String : Any]? {<br>        return nil<br>    }<br><br>    var bodyObject: Employee? {<br>        switch self {<br>        case .createEmployee(let employee), .updateEmployee(_, let employee):<br>            return employee<br>        default:<br>            return nil<br>        }<br>    }<br>}</pre><p>In the above code, we provide the necessary information for request creation within the EmployeeRequests enum. Each case in the enum corresponds to a specific request, and we specify the appropriate values for the URLRequest properties.</p><h4>Creating and Using Requests:</h4><p>With the create method implemented, we can now easily create and use requests. Here are some examples:</p><pre>do {<br>    let request1 = try EmployeeRequests.getAllEmployees.create()<br>    // Request created<br>    // Make a call<br>} catch {<br>    // Error in request creation<br>}<br><br>if let request2 = try? EmployeeRequests.getEmployee(1).create() {<br>    // Request created<br>    // Make a call<br>} else {<br>    // Error in request creation<br>}<br><br>let request3 = try? EmployeeRequests.deleteEmployee(1).create()<br><br>let request4 = try? EmployeeRequests.searchEmployees(&quot;test&quot;, 1000, nil).create()<br><br>let employee = Employee(<br>    name: &quot;test&quot;,<br>    salary: 123456,<br>    age: 18,<br>    id: nil<br>)<br><br>let request5 = try? EmployeeRequests.createEmployee(employee).create()<br><br>let request6 = try? EmployeeRequests.updateEmployee(1, employee).create()</pre><h4>Conclusion:</h4><p>By following this approach, we can architect our code to easily create different types of URLRequest based on the specific API requirements. The protocol-oriented design allows us to define common properties and methods, reducing duplication and providing a clean and scalable structure.</p><h4>Tips:</h4><p><em>When the base URL is the same for multiple APIs, define it as a default value in the protocol extension.</em></p><pre>/// Here we are passing default base URL that most of the apis in app will have<br>/// However in some case different module may have different base URL<br>/// Then that different base URL can be provided from that module.<br>extension URLRequestCreator  {<br>    var baseUrlString: String {<br>        &quot;https://dummy.restapiexample.com&quot;<br>    }<br>}</pre><p>By doing so we do not need to pass the base URL from EmployeeRequests. It becomes optional and that is when we delete the code of providing the base URL and still the build succeeds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*iE58XgICytu1whCKMtpo8g.gif" /></figure><p><em>Similarly, consider creating enums for common values, such as HTTP methods or API versions, to improve code clarity and maintainability. Example:</em></p><pre>enum HTTPRequestMethod: String {<br>    case GET<br>    case POST<br>    case PUT<br>    case DELETE<br>    case PATCH<br>}<br><br>enum HTTPRequestAPIVersion: String {<br>    case v1<br>    case v2<br>    case v3<br>}</pre><p><em>Usage:</em></p><pre>protocol URLRequestCreator {<br>    var apiVersion: HTTPRequestAPIVersion? { get }<br>    var method: HTTPRequestMethod { get }<br>}<br><br>extension EmployeeRequests: URLRequestCreator {<br>    var apiVersion: HTTPRequestAPIVersion? {<br>        .v1<br>    }<br><br>    var method: HTTPRequestMethod {<br>        switch self {<br>        case .getAllEmployees:<br>            return .GET<br>        case .getEmployee:<br>            return .GET<br>        case .createEmployee:<br>            return .POST<br>        case .updateEmployee:<br>            return .PUT<br>        case .deleteEmployee:<br>            return .DELETE<br>        case .searchEmployees:<br>            return .GET<br>        }<br>    }<br>}</pre><p>We hope this guide helps you structure your code for creating URLRequest efficiently. Your feedback is highly appreciated!</p><p>And here is the complete project URL: <a href="https://github.com/ravirajw/NetworkingClient">https://github.com/ravirajw/NetworkingClient</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27910b564e9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Swift Packages with Xcode]]></title>
            <link>https://medium.com/@w.raviraj/creating-swift-packages-with-xcode-6c96da2e756b?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c96da2e756b</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[spm]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Fri, 26 May 2023 09:52:08 GMT</pubDate>
            <atom:updated>2023-05-26T09:53:30.563Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*QlE6GNnWM-01AARkcMl3rA.jpeg" /></figure><h4>Introduction:</h4><p>Swift packages serve as collections of reusable code or components that developers can integrate into their projects.</p><p>They allow for the distribution of reusable content among various projects and developer communities.</p><p>Furthermore, packages facilitate modularity by extracting specific project parts as independent entities that can be shared and utilized in other projects.</p><h4>Getting Started:</h4><p>To create a Swift package, follow these steps:</p><ol><li>Open Xcode and select “Create a new Xcode project” from the launch screen.</li><li>Choose the Multiplatform &gt; Swift Package template.</li><li>Provide a name for your package, such as CountryPicker.</li><li>Now, you have a basic template to work with, where you can design the desired component according to your requirements.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*dgcdPPjfPX-nZhTE4am03g.gif" /></figure><h4>Updating Platforms (optional):</h4><p>Consider updating the minimum supported versions of the platforms your package will work with. By default, Swift packages support macOS v10.13 and iOS v11. However, it is advisable to target the latest versions, as most Apple users stay up to date. To update the platforms, modify the Package.swift file with the following code:</p><pre>platforms: [<br>    .macOS(.v12),<br>    .iOS(.v15)<br>],</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sH9FYBfR1G3fjnwxXjyXGQ.png" /></figure><h4>Creating the Component:</h4><p>This is our starting place. Create the desired component that you intend to distribute within the package. I will not dig deep into this because this is not in the scope of the article. So assume we created a component.</p><pre>public struct CountryPicker {<br>    public private(set) var text = &quot;Hello, World!&quot;<br>    <br>    public init() {<br>    }<br>}</pre><p>The component files should be placed inside the Sources folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*tEmbBlUezNuRUYZ9J83WGg.png" /></figure><p>For more details, you can refer to the code of our sample component available at the <a href="https://github.com/ravirajw/CountryPicker">GitHub Repository URL</a>.</p><h4>Publishing the Package on GitHub:</h4><p>Follow these steps to publish your package on GitHub:</p><ol><li>Open the GitHub Desktop app.</li><li>From the toolbar, select File &gt; Add Local Repository.</li><li>Choose the project directory, such as Desktop &gt; CountryPicker.</li><li>Create a repository and publish it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*GY8XYfxuEP8rDSYwZJnR_g.gif" /></figure><p>Uploading the package to GitHub will make it accessible for others to use and integrate into their projects.</p><p>Example: See your package on GitHub after being uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ovG3L_UvyExfnsJ6JqpUg.png" /></figure><h4>Adding the Swift Package to Your Project:</h4><p>To incorporate the Swift package into your project, follow these steps:</p><ol><li>Open your Xcode project.</li><li>Go to Files &gt; Add packages through the top toolbar.</li><li>Copy and paste the package URL into the popup window and add it to your project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RvvRJ9Pbkw4N3ILPwPSnBw.gif" /></figure><h4>Using the CountryPicker Package in Your Project:</h4><p>To utilize the CountryPicker package in your project, follow these steps:</p><ol><li>Import CountryPicker.</li><li>Initialize the CountryPicker and pass the initial country you want to display in the country picker field.</li></ol><ul><li>By default, we show the device country selected using Locale.current.regionCode.</li><li>If the device country cannot be determined, the country field displays the Not selected value.</li></ul><pre>import SwiftUI<br>import CountryPicker<br><br>struct ContentView: View {<br>    @State var countryISOCode = Locale.current.regionCode ?? Country.countryNotSelected.code<br><br>    var body: some View {<br>        VStack {<br>            CountryPicker(initialCountryISOCode: $countryISOCode)<br>        }<br>        .padding()<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*u5zKZbk7F0WYQG_O_MgyuQ.gif" /></figure><h4>Conclusion:</h4><p>By following the steps outlined above, you can create and distribute Swift packages using Xcode. These packages enable code reuse, modularity, and collaboration among developers. Incorporating packages into your projects allows for streamlined development and enhances productivity. Feel free to explore and integrate the CountryPicker package from the example URL provided: <a href="https://github.com/ravirajw/CountryPicker/tree/main/Example">CountryPicker Example</a>.</p><p>Happy coding! 😁</p><p>Thanks 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c96da2e756b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a list in SwiftUI with sticky section headers]]></title>
            <link>https://medium.com/evangelist-apps/create-a-list-in-swiftui-with-sticky-section-headers-373bab2f9e96?source=rss-bd365efdbf95------2</link>
            <guid isPermaLink="false">https://medium.com/p/373bab2f9e96</guid>
            <category><![CDATA[lists]]></category>
            <category><![CDATA[tableviews]]></category>
            <category><![CDATA[stickyheader]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Raviraj Wadhwa]]></dc:creator>
            <pubDate>Wed, 11 Jan 2023 07:53:08 GMT</pubDate>
            <atom:updated>2023-01-23T13:17:33.949Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A76YzrvHNtbm9Gb3C66WVA.png" /></figure><p>Recently I was assigned a task to create a list that has multiple sections and each section has a `heading` and some items. Please refer to the below gif to understand the requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*lCbuITWm4e9kW14T_gEWIw.gif" /></figure><p>Looking at the design I straightaway thought of using a <strong><em>List</em></strong> view. Because in <strong><em>List</em></strong> we can add <strong><em>Sections</em></strong> with custom cells and a header. And these headers are by default sticky. Similar to <strong><em>UITableView</em></strong>.</p><pre>List {<br>  Section {<br>    // Here goes the items<br>  } header: {<br>    // Here goes the header<br>  }<br><br>  // Here we can add any no. of sections...<br><br>}</pre><p>While implementing the <strong><em>List</em></strong> view I found out that by default it has row separators, section header separators, white background colour, and different row and header insets (screenshot attached).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLklwHDJjVbTThjyLc0ePQ.png" /></figure><p>So I started my research on customizing the <strong><em>List</em></strong> view and after some research, I found out that the <strong><em>List</em></strong> view is very tricky to customize. The properties of hiding row separators, section header separators, and changing background colour were unavailable for iOS 14. Yes, it was the client&#39;s requirement to support iOS14. Also, changing the header and row insets of the <strong><em>List </em></strong>view was extra work.</p><p>So I decided not to use <strong><em>List</em></strong> view and was looking for some other solution and I found that in the form of <strong><em>LazyVStack.</em></strong></p><blockquote><strong><em>LazyVStack </em></strong>is a view that arranges its children in a line that grows vertically, creating items only as needed. The stack is “lazy,” in the sense that the stack view doesn’t create items until it needs to render them onscreen. Example:</blockquote><pre>ScrollView {<br>    LazyVStack(alignment: .leading) {<br>        ForEach(1...100, id: \.self) {<br>            Text(&quot;Row \($0)&quot;)<br>        }<br>    }<br>}</pre><blockquote>The plus point of <strong><em>LazyVStack </em></strong>is that it comes with one more initializer where we can have pinned (sticky) views.</blockquote><blockquote>Please refer to this for more details:</blockquote><blockquote><a href="https://developer.apple.com/documentation/swiftui/lazyvstack">https://developer.apple.com/documentation/swiftui/lazyvstack</a></blockquote><blockquote><a href="https://developer.apple.com/documentation/swiftui/lazyvstack/init(alignment:spacing:pinnedviews:content:)">https://developer.apple.com/documentation/swiftui/lazyvstack/init(alignment:spacing:pinnedviews:content:)</a></blockquote><blockquote>And this is how I have used it in my app.</blockquote><pre>    var body: some View {<br>        ScrollView {<br>            LazyVStack(alignment: .leading, spacing: 0, pinnedViews: [.sectionHeaders]) {<br>                // Lakes<br>                Section {<br>                    ForEach(lakes, id: \.self) { landmark in<br>                        LandmarkCellView(landmarkName: landmark)<br>                    }<br>                } header: {<br>                    ListHeaderView(title: &quot;Lakes&quot;)<br>                }<br><br>                // Mountains<br>                Section {<br>                    ForEach(mountains, id: \.self) { landmark in<br>                        LandmarkCellView(landmarkName: landmark)<br>                    }<br>                } header: {<br>                    ListHeaderView(title: &quot;Mountains&quot;)<br>                }<br><br>                // Rivers<br>                Section {<br>                    ForEach(rivers, id: \.self) { landmark in<br>                        LandmarkCellView(landmarkName: landmark)<br>                    }<br>                } header: {<br>                    ListHeaderView(title: &quot;Rivers&quot;)<br>                }<br>            }<br>        }<br>        .padding(.horizontal, Constants.padding15)<br>    }</pre><p>As per the example, I embed <strong><em>LazyVStack</em></strong> in <strong><em>ScrollView</em></strong>. Then I have three <strong><em>Sections</em></strong> one for <strong><em>Lakes</em>,</strong> one for <strong><em>Mountains</em></strong>, and one for <strong><em>Rivers</em></strong>. Each <strong><em>Section</em></strong> has its own header label and cells. And the result is as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*lCbuITWm4e9kW14T_gEWIw.gif" /></figure><p>Thanks for your time. I hope it helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=373bab2f9e96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/evangelist-apps/create-a-list-in-swiftui-with-sticky-section-headers-373bab2f9e96">Create a list in SwiftUI with sticky section headers</a> was originally published in <a href="https://medium.com/evangelist-apps">Evangelist Apps Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>