<?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 Kajal Sheth on Medium]]></title>
        <description><![CDATA[Stories by Kajal Sheth on Medium]]></description>
        <link>https://medium.com/@shethkajal?source=rss-586e8e992267------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MG3TeLOCmkY8ckXya6kHpA.jpeg</url>
            <title>Stories by Kajal Sheth on Medium</title>
            <link>https://medium.com/@shethkajal?source=rss-586e8e992267------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:26:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shethkajal/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[Building a Simple Notes Application in SwiftUI: A Step-by-Step Tutorial]]></title>
            <link>https://shethkajal.medium.com/building-a-simple-notes-application-in-swiftui-a-step-by-step-tutorial-465a9ef8083?source=rss-586e8e992267------2</link>
            <guid isPermaLink="false">https://medium.com/p/465a9ef8083</guid>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Kajal Sheth]]></dc:creator>
            <pubDate>Sun, 21 May 2023 18:01:16 GMT</pubDate>
            <atom:updated>2023-05-21T18:01:16.053Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s digital age, note-taking is an essential part of many people’s daily lives. Whether it’s for jotting down ideas, keeping track of tasks, or simply jotting down important information, having a notes app on your mobile device or computer is extremely useful.</p><p>In this step-by-step tutorial, we will build a simple notes application using SwiftUI — Apple’s declarative framework for building user interfaces. We’ll start by designing the user interface for the note list and detail views, then define the Note model, connect the views using a NavigationLink, and add data persistence using UserDefaults.</p><p>By the end of this tutorial, you’ll have a solid understanding of how to build a basic SwiftUI app that handles navigation, data models, and data persistence. So, let’s get started!</p><h3>Step 1: Create a new SwiftUI project</h3><p>To start, open Xcode and create a new SwiftUI project. Choose “App” as the template and give your project a name.</p><h3>Step 2: Design the Note List View</h3><p>Next, design the UI for the Note List view. This view will display a list of notes and allow users to create new notes. Here’s some sample code to get started:</p><pre>struct NoteListView: View {<br>    @State var notes = [Note]() // array of Note objects<br>    <br>    var body: some View {<br>        NavigationView {<br>            List(notes) { note in<br>                NavigationLink(destination: NoteDetailView(note: note)) {<br>                    Text(note.title)<br>                }<br>            }<br>            .navigationBarTitle(&quot;Notes&quot;)<br>            .navigationBarItems(trailing:<br>                Button(action: {<br>                    let newNote = Note()<br>                    notes.append(newNote)<br>                }) {<br>                    Image(systemName: &quot;plus&quot;)<br>                }<br>            )<br>        }<br>    }<br>}</pre><p>This code defines a NoteListView struct with a notes array property that holds an array of Note objects. The body property returns a NavigationView with a List that displays the titles of each note in the notes array. Tapping on a note navigates to a NoteDetailView that displays the details of the selected note. The navigation bar also includes a &quot;+&quot; button that allows users to create new notes.</p><h3>Step 3: Define the Note Model</h3><p>Before you can create and display notes, you need to define the Note model. Here&#39;s some sample code to get started:</p><pre>struct Note: Identifiable {<br>    let id = UUID()<br>    var title: String = &quot;&quot;<br>    var body: String = &quot;&quot;<br>    var createdAt: Date = Date()<br>}</pre><p>This code defines a Note struct that conforms to the Identifiable protocol. The Note struct has four properties: an id property that holds a UUID, a title property that holds the note&#39;s title, a body property that holds the note&#39;s body, and a createdAt property that holds the note&#39;s creation date.</p><h3>Step 4: Design the Note Detail View</h3><p>Next, design the UI for the Note Detail view. This view will display the details of a selected note and allow users to edit the note. Here’s some sample code to get started:</p><pre>struct NoteDetailView: View {<br>    @State var note: Note<br>    <br>    var body: some View {<br>        VStack {<br>            TextEditor(text: $note.title)<br>                .font(.title)<br>            Divider()<br>            TextEditor(text: $note.body)<br>                .frame(minHeight: 200)<br>            Spacer()<br>        }<br>        .padding()<br>        .navigationBarTitle(Text(note.title), displayMode: .inline)<br>    }<br>}</pre><p>This code defines a NoteDetailView struct with a note property that holds a Note object. The body property returns a VStack that displays two TextEditor views: one for the note&#39;s title and one for the note&#39;s body. The navigation bar title displays the note&#39;s title.</p><h3>Step 5: Connect the Views</h3><p>Finally, connect the NoteListView and NoteDetailView views using a NavigationLink and pass the selected Note object from the list to the detail view. Here&#39;s the updated NoteListView code:</p><pre>struct NoteListView: View {<br>    @State var notes = [Note]() // array of Note objects<br>    <br>    var body: some View {<br>        NavigationView {<br>            List(notes) {<br>                NavigationLink(destination: NoteDetailView(note: note)) {<br>                    Text(note.title)<br>                }<br>            }<br>            .navigationBarTitle(&quot;Notes&quot;)<br>            .navigationBarItems(trailing:<br>                Button(action: {<br>                    let newNote = Note()<br>                    notes.append(newNote)<br>                }) {<br>                    Image(systemName: &quot;plus&quot;)<br>                }<br>            )<br>        }<br>    }<br>}</pre><p>This code uses a NavigationLink to navigate from the NoteListView to the NoteDetailView. When a user taps on a note in the list, the NavigationLink passes the selected Note object to the NoteDetailView.</p><h3>Step 6: Save and Load Notes</h3><p>To allow users to save and load their notes, you’ll need to implement some data persistence. One simple way to do this is to use the UserDefaults API to save the notes as an array of dictionaries, where each dictionary represents a single note. Here&#39;s some sample code to get started:</p><pre>extension Note {<br>    init(dictionary: [String: Any]) {<br>        self.id = UUID(uuidString: dictionary[&quot;id&quot;] as! String)!<br>        self.title = dictionary[&quot;title&quot;] as! String<br>        self.body = dictionary[&quot;body&quot;] as! String<br>        self.createdAt = dictionary[&quot;createdAt&quot;] as! Date<br>    }<br>    <br>    func toDictionary() -&gt; [String: Any] {<br>        return [<br>            &quot;id&quot;: id.uuidString,<br>            &quot;title&quot;: title,<br>            &quot;body&quot;: body,<br>            &quot;createdAt&quot;: createdAt<br>        ]<br>    }<br>}<br><br>class NoteStore: ObservableObject {<br>    @Published var notes = [Note]()<br>    <br>    init() {<br>        loadNotes()<br>    }<br>    <br>    func saveNotes() {<br>        let noteDictionaries = notes.map { $0.toDictionary() }<br>        UserDefaults.standard.set(noteDictionaries, forKey: &quot;notes&quot;)<br>    }<br>    <br>    func loadNotes() {<br>        guard let noteDictionaries = UserDefaults.standard.array(forKey: &quot;notes&quot;) as? [[String: Any]] else {<br>            return<br>        }<br>        <br>        notes = noteDictionaries.map { Note(dictionary: $0) }<br>    }<br>}</pre><p>This code extends the Note struct with an init(dictionary:) method that initializes a Note object from a dictionary, and a toDictionary() method that converts a Note object to a dictionary. The NoteStore class is an ObservableObject that holds an array of Note objects and provides methods to save and load the notes from UserDefaults. The init() method calls loadNotes() to load the notes from UserDefaults when the app launches.</p><h3>Step 7: Connect the NoteStore to the Views</h3><p>Finally, connect the NoteStore to the NoteListView and NoteDetailView views by adding an instance of the NoteStore class to the app&#39;s environment. Here&#39;s the updated Scene code:</p><pre>@main<br>struct NotesApp: App {<br>    @StateObject var noteStore = NoteStore()<br>    <br>    var body: some Scene {<br>        WindowGroup {<br>            NoteListView(notes: noteStore.notes)<br>                .environmentObject(noteStore)<br>        }<br>    }<br>}</pre><p>This code creates an instance of the NoteStore class as a @StateObject and adds it to the app&#39;s environment using the environmentObject() method. The NoteListView receives the notes array as a parameter and the NoteDetailView receives the selected Note object as a parameter.</p><h3>Conclusion</h3><p>In this tutorial, we’ve built a simple notes application in SwiftUI. We’ve designed the UI for the note list and detail views, defined the Note model, connected the views using a NavigationLink, and added data persistence using UserDefaults. By the end of this tutorial, you should have a good understanding of how to build a basic SwiftUI app that handles navigation, data models, and data persistence.</p><p>Of course, this is just a starting point. You can build upon this codebase and add more features to your notes app. For example, you could add support for different types of notes (e.g., to-do lists, voice memos, images), add a search feature, or implement a sharing feature.</p><p>I hope this tutorial has been helpful, and that it has given you a solid foundation for building SwiftUI apps. As always, keep experimenting and have fun!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=465a9ef8083" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Importance of Stepping Outside Your Comfort Zone for Personal Growth]]></title>
            <link>https://shethkajal.medium.com/the-importance-of-stepping-outside-your-comfort-zone-for-personal-growth-15a821bc4eba?source=rss-586e8e992267------2</link>
            <guid isPermaLink="false">https://medium.com/p/15a821bc4eba</guid>
            <category><![CDATA[self-reflection]]></category>
            <category><![CDATA[positive-influence]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[risk-taking]]></category>
            <category><![CDATA[goal-setting]]></category>
            <dc:creator><![CDATA[Kajal Sheth]]></dc:creator>
            <pubDate>Thu, 04 May 2023 20:23:52 GMT</pubDate>
            <atom:updated>2023-05-04T20:23:52.657Z</atom:updated>
            <content:encoded><![CDATA[<p>As individuals, we often get comfortable with our routines and our ways of doing things. We hold onto what has worked for us in the past, and we’re hesitant to try new things or take risks. But if we want to grow and develop as people, we need to be willing to step outside of our comfort zones and challenge ourselves.</p><p>Just like in our professional lives, growth and development in our personal lives is an ongoing process. We can’t rely on what worked for us in the past to carry us through our entire lives. We need to be constantly learning, growing, and adapting to new situations and experiences.</p><p>Here are a few tips for personal growth and development:</p><ol><li>Try new things: Don’t be afraid to try new hobbies, activities, or experiences. You never know what you might discover about yourself or what new passions you might uncover.</li><li>Embrace failure: Just like in our professional lives, failure is an inevitable part of personal growth. Don’t be afraid to make mistakes or take risks — that’s how we learn and grow.</li><li>Practice self-reflection: Take time to reflect on your experiences and your emotions. What are you feeling? Why are you feeling that way? What can you learn from the situation?</li><li>Set personal goals: Set clear, measurable goals for yourself and work towards achieving them. This will help you stay focused and motivated, and will give you a sense of accomplishment when you reach your goals.</li><li>Surround yourself with positive influences: Surround yourself with people who inspire you, challenge you, and support you. Avoid negative influences that bring you down or hold you back.</li></ol><p>In conclusion, personal growth and development is an ongoing process that requires us to be open to new experiences, willing to take risks, and committed to learning and growing each and every day. It can be challenging, but the rewards are worth it — greater self-awareness, increased self-confidence, and a more fulfilling life. So embrace change, take risks, and keep moving forward — your future self will thank you for it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15a821bc4eba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Dispatch Boom and the Curse of Swift: A Programmer’s Comedy]]></title>
            <link>https://shethkajal.medium.com/the-dispatch-boom-and-the-curse-of-swift-a-programmers-comedy-66be40e4069b?source=rss-586e8e992267------2</link>
            <guid isPermaLink="false">https://medium.com/p/66be40e4069b</guid>
            <dc:creator><![CDATA[Kajal Sheth]]></dc:creator>
            <pubDate>Thu, 04 May 2023 19:03:37 GMT</pubDate>
            <atom:updated>2023-05-04T19:03:37.314Z</atom:updated>
            <content:encoded><![CDATA[<p>Programming can be a stressful job, with tight deadlines, complex projects, and ever-evolving technologies. But sometimes, the challenges we face can also be a source of humor. In this blog post, we’ll explore two phenomena that have taken the programming world by storm: the Dispatch Boom and the Curse of Swift. And we’ll do it all with a healthy dose of humor and some simple examples.</p><h4>The Dispatch Boom:</h4><p>First, let’s talk about the Dispatch Boom. For those who are not familiar, Dispatch is a powerful framework in iOS and macOS development that helps manage concurrency and asynchronous tasks. It’s a real game-changer for developers who need to juggle multiple tasks at once.</p><p>But with great power comes great responsibility, as they say. And the Dispatch Boom is all about developers who get a little too excited about Dispatch and start using it for everything.</p><p>Need to load some data from a server?</p><blockquote>Dispatch! 🙄</blockquote><p>Need to update the UI?</p><blockquote>Dispatch! 🙄</blockquote><p>Need to make a sandwich?</p><blockquote>DISPATCH! 🙄</blockquote><p>Okay, maybe not that last one 🤭. But you get the idea💡.</p><p>The Dispatch Boom is all about overusing a powerful tool and turning it into a crutch. And it can lead to some hilarious (and frustrating) code.</p><p>Example: Here’s a simple example of the Dispatch Boom in action. Let’s say you have a function that loads some data from a server and then updates the UI with that data. Here’s how you might use Dispatch:</p><pre>func loadDataAndRefreshUI() {<br>    DispatchQueue.global(qos: .background).async {<br>        // Load data from server<br>        let data = loadDataFromServer()<br>        <br>        DispatchQueue.main.async {<br>            // Update UI with data<br>            updateUIWithData(data)<br>        }<br>    }<br>}</pre><p>Now, this code is perfectly valid. But imagine if you started using Dispatch for every little thing, like updating a label or changing the background color. You’d end up with a mess of nested blocks that are hard to read and even harder to debug. That’s the Dispatch Boom in a nutshell.</p><h4>The Curse of Swift:</h4><p>Next, let’s talk about the Curse of Swift. Swift is a modern, powerful programming language that has taken the world by storm. It’s easy to learn, easy to read, and easy to write. But with all that ease comes a curse.</p><p>The Curse of Swift is all about developers who get a little too comfortable with the language and start writing code that’s overly clever or cryptic. They’ll use obscure features, one-liners, and functional programming techniques to create code that’s a real head-scratcher for anyone who comes after them.</p><p>Example: Here’s an example of the Curse of Swift in action. Let’s say you have an array of numbers, and you want to filter out all the even ones. Here’s how you might do it with a simple for loop:</p><pre>let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]<br>var evens: [Int] = []<br><br>for number in numbers {<br>    if number % 2 == 0 {<br>        evens.append(number)<br>    }<br>}</pre><p>Now, this code is perfectly readable and understandable. But imagine if you tried to get clever and use a one-liner instead:</p><pre>let evens = numbers.filter { $0 % 2 == 0 }</pre><p>Sure, this code is shorter and more concise. But it’s also harder to read and understand, especially for someone who’s not familiar with Swift’s functional programming features. That’s the Curse of Swift in a nutshell.</p><h4>Conclusion:</h4><p>It’s crucial to keep in mind that while Dispatch is a potent programming tool, it cannot solve all of our coding issues like a magic solution. Just as you cannot construct a building using only a hammer, relying solely on Dispatch may result in a convoluted and challenging-to-debug code, similar to a Rubik’s Cube. Consequently, we should utilize Dispatch like any other programming tool, carefully and prudently. By striking a balance between Dispatch and other programming constructs, we can develop software that is efficient, easy to read, and maintainable. And who knows, maybe one day we’ll look back at our old code and have a good laugh at how we thought Dispatch was the answer to everything.</p><p>Happy coding! 👩🏽‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66be40e4069b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate UIScrollView with Auto Layout?]]></title>
            <link>https://shethkajal.medium.com/how-to-integrate-uiscrollview-with-auto-layout-9ba46eed4708?source=rss-586e8e992267------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ba46eed4708</guid>
            <category><![CDATA[autolayout-constraints]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[uiscrollview]]></category>
            <category><![CDATA[constraints]]></category>
            <dc:creator><![CDATA[Kajal Sheth]]></dc:creator>
            <pubDate>Wed, 09 Jun 2021 20:10:03 GMT</pubDate>
            <atom:updated>2021-06-09T20:10:03.277Z</atom:updated>
            <content:encoded><![CDATA[<p>UIScrollView is one of the most versatile and useful controls in iOS. Usually, some of our most important screens are scroll views: Various types of forms like login, sign up and detail view, etc.</p><p>Here is the easiest way to integrate UIScrollView.</p><p>Let’s do it step by step:</p><ol><li>Drag UIScrollView from the object library onto the UIViewController.</li></ol><p>2. Set constraints of UIScrollView</p><ul><li>[Scroll View].[Leading] = [Super View].[Leading]</li><li>[Scroll View].[Trailing] = [Super View].[Trailing]</li><li>[Scroll View].[Top] = [Super View].[Top]</li><li>[Scroll View].[Bottom] = [Super View].[Bottom]</li><li>[Scroll View].[Centre H] = [Super View].[Centre]</li></ul><blockquote>Please note: UIScrollView component has a minimum requirement of the following constraints:</blockquote><blockquote>Top, Bottom, Leading, Trailing, Centre</blockquote><p>3. Go to Size Inspector on Right Panel and disable “Content Layout Guide”.</p><p>4. Drag and drop an UIImageView to the UIViewController.</p><p>5. Set constraints to 40 as Top, Centre Horizontal to Main View, add an aspect ratio to UIImageView 1:1, and add a height as 200.</p><p><strong><em>Aspect Ratio</em></strong></p><p>This constraint works with one of the above two constraints. It is generally used for images, if you have a fixed aspect ratio for an image then provide either height or width to your image view or button for that matter and give it an aspect ratio. This will maintain the quality of your image.</p><p>6. Add a UIButton below the UIImageView. Change the text to “Upload”.</p><p>7. Add constraints to UIButton (20,20,20,20) as (top, bottom, leading and trailing), and also height.</p><p>And the screen is ready.</p><p>I hope you have got the easiest way to integrate UIScrollView.</p><p>If you have any comments or suggestions, feel free to comment below.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ba46eed4708" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>