<?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 Ines BOKRI on Medium]]></title>
        <description><![CDATA[Stories by Ines BOKRI on Medium]]></description>
        <link>https://medium.com/@ines.bokri.belgacem?source=rss-4aa42771362a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*28KXY7RUNSKsBrG5LTBccw.jpeg</url>
            <title>Stories by Ines BOKRI on Medium</title>
            <link>https://medium.com/@ines.bokri.belgacem?source=rss-4aa42771362a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 13:51:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ines.bokri.belgacem/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[iPhone Duo & SwiftUI: Meet ArrangementView]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/iphone-duo-swiftui-meet-arrangementview-fa07d024a234?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa07d024a234</guid>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 09:16:39 GMT</pubDate>
            <atom:updated>2026-09-15T09:16:39.089Z</atom:updated>
            <content:encoded><![CDATA[<p>Everyone is getting ready for <strong>iPhone Duo</strong>, and one of the biggest changes for iOS developers is how we think about adaptive layouts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrRtF3kUKR7HvBzPxi0JPA.png" /></figure><p>Instead of relying on device orientation checks, we can start thinking in terms of <strong>size classes and available space</strong>.</p><p>That’s where <strong>ArrangementView</strong> comes in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_LzEpu6g9BH0Da2trb-Mg.png" /></figure><p>It takes a <strong>primary</strong> and a <strong>secondary</strong> view, then decides how to arrange them based on:</p><ul><li>Size classes</li><li>Screen aspect ratio</li><li>Division regions, such as a hinge</li></ul><p>With <strong>.split</strong>, the available space is divided between the two views.</p><p>With <strong>.overlay</strong>, the views can overlap and adapt as the device folds.</p><p>One important detail: if the space can’t be split along the selected axis, <strong>only one view may be displayed</strong>.</p><p>The bigger idea is simple:</p><blockquote><strong><em>Stop designing for device orientation. Start designing for available space.</em></strong></blockquote><p>And this is just the beginning. 🚀</p><p>#SwiftUI #iOS #Swift #iPhoneDuo #Apple #iOSDevelopment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa07d024a234" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[struct, class, actor: A Simple Way to Remember the Difference]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/struct-class-actor-a-simple-way-to-remember-the-difference-f07e2f5f0c8f?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f07e2f5f0c8f</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 14:06:48 GMT</pubDate>
            <atom:updated>2026-08-25T14:07:45.539Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve spent time with Swift, you’ve used all three. But when someone asks you to explain the difference <em>simply</em>, it’s surprisingly easy to overcomplicate the answer.</p><p>Here’s the version I wish someone had given me early on — with real-world analogies and code you can run in five seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBkz5a0LGDPVl6VsdZh2PQ.png" /></figure><h3>struct — Your Own Copy</h3><p>A struct is like a sheet of paper. If you hand someone a copy and they write on it, your original sheet doesn&#39;t change.</p><pre>struct Point { var x = 0 }</pre><pre>var a = Point()<br>var b = a<br>b.x = 10<br>// a.x is still 0</pre><p>a and b are two completely independent copies. No shared memory, no surprises.</p><h3>class — A Shared Document, No Guardrails</h3><p>A class is like a Google Doc shared with someone else. You both have the same link, and if either of you edits it, the other person sees the change immediately.</p><pre>class Point { var x = 0 }</pre><pre>let a = Point()<br>let b = a<br>b.x = 10<br>// a.x is also 10 — a and b point to the same object</pre><p>This is powerful, but it comes with a risk: if two people (or two threads) write to the same document at the exact same time, you get chaos.</p><p>In code, that’s a <strong>data race</strong>.</p><h3>actor — The Same Document, With a Bouncer</h3><p>An actor behaves like a class — reference type, shared state — but it comes with a built-in rule: only one piece of code can touch its state at a time.</p><p>Everyone else has to wait their turn, using await.</p><pre>actor Point { var x = 0 }</pre><pre>let a = Point()<br>await a.x // you must go through `await` to access it.</pre><p>The compiler enforces this for you. No manual locks, no race conditions — the isolation is part of the type itself.</p><h3>The Short Version</h3><p>TypeBehaviorSafetystructYour own copyNaturally safe — nothing to shareclassShared, no protectionFast, but risky under concurrencyactorShared, protectedSafe by design, enforced by the compiler</p><p>Once it clicks, the choice between the three stops being about syntax — it becomes about <em>how much you need to share, and how safely</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f07e2f5f0c8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Use AI as a Senior iOS Developer]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/how-i-use-ai-as-a-senior-ios-developer-c6690a166896?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6690a166896</guid>
            <category><![CDATA[iaio]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 12:36:18 GMT</pubDate>
            <atom:updated>2026-08-25T12:36:18.200Z</atom:updated>
            <content:encoded><![CDATA[<p><em>AI is not replacing my experience. It is changing how I use it.</em></p><p>After more than a decade of building native iOS applications, I have learned that being a senior developer is not about writing code faster.</p><p>It is about making better decisions.</p><p>Architecture. Trade-offs. Maintainability. Performance. User experience. Technical debt. Knowing when to keep things simple and when to introduce complexity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LbYRtfmDb97xYpCZ6no-iQ.png" /><figcaption>A balance scale: AI on the light side (speed), experience on the heavy side (judgment), tipping toward better decisions — with the six pillars underneath as the foundation</figcaption></figure><p>The rise of AI-assisted development has not changed that.</p><p>What has changed is <strong>how I approach my daily work</strong>.</p><p>AI has become another tool in my engineering toolbox, not a replacement for engineering judgment.</p><p><strong>1. I Use AI to Explore Solutions</strong></p><p>One of my favorite uses of AI is not asking it to write the final implementation.</p><p>Instead, I use it as a technical brainstorming partner.</p><p>For example:</p><p>“What are three approaches to implementing this feature using Swift Concurrency? What are the trade-offs of each?”</p><p>This is much more useful to me than:</p><p>“Write the code for this feature.”</p><p>The first question encourages exploration.</p><p>I can compare approaches, identify potential problems, and then decide which one fits the project.</p><p>This is particularly useful when dealing with architectural decisions.</p><p>For example:</p><ul><li>MVVM vs. a more feature-oriented architecture</li><li>async/await vs. Combine</li><li>Actor isolation</li><li>Dependency injection strategies</li><li>Caching approaches</li><li>Networking abstractions</li><li>SwiftUI state management</li></ul><p>AI gives me possibilities.</p><p><strong>Experience gives me the criteria to evaluate them.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFZYDzZ9o9Ry9VYNDhxO-Q.png" /></figure><p><strong>2. I Use AI as a Code Reviewer</strong></p><p>Another powerful use case is reviewing code I have already written.</p><p>Instead of asking:</p><p>“Write this code.”</p><p>I might ask:</p><p>“Review this implementation. Look specifically for concurrency issues, unnecessary complexity, memory management problems, and potential performance issues.”</p><p>This changes the relationship with AI.</p><p>I’m not asking it to replace my implementation.</p><p>I’m asking it to challenge my assumptions.</p><p>Sometimes it finds something useful.</p><p>Sometimes it doesn’t.</p><p>And sometimes it suggests something that looks technically correct but would be completely inappropriate for the project.</p><p>That’s fine.</p><p>The goal isn’t to blindly accept the answer.</p><p>The goal is to have <strong>another perspective</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXPsIYWYZ6mRrEfF7bgBhg.png" /></figure><p><strong>3. AI Is Extremely Useful for Boilerplate</strong></p><p>There are many tasks where I don’t need to spend my mental energy.</p><p>For example:</p><ul><li>Generating test cases</li><li>Creating mocks</li><li>Writing repetitive models</li><li>Generating documentation</li><li>Converting data structures</li><li>Creating sample JSON</li><li>Writing basic Swift extensions</li><li>Preparing migration scripts</li><li>Generating repetitive UI code</li></ul><p>These tasks are not necessarily difficult.</p><p>They are simply time-consuming.</p><p>AI is very good at them.</p><p>And this is where I see one of the biggest productivity gains.</p><p>The value isn’t that AI writes code that I couldn’t write.</p><p>The value is that <strong>I don’t have to spend my attention writing code that doesn’t require much engineering judgment.</strong></p><p><strong>4. Swift Concurrency Is a Good Example</strong></p><p>Modern Swift has introduced a significant shift in how we reason about concurrency.</p><p>Actors, <strong>Sendable</strong>, structured concurrency, isolation and <strong>async/await</strong> can sometimes produce compiler errors that require a deeper understanding of Swift’s concurrency model.</p><p>AI can be very helpful here.</p><p>I can give it a compiler error and ask:</p><p>“Explain why this code violates actor isolation and show me two possible solutions.”</p><p>The important part isn’t copying the proposed solution.</p><p>It’s understanding <strong>why</strong> the compiler is complaining.</p><p>As a senior developer, I still want to understand the underlying model.</p><p>AI accelerates the learning process.</p><p>It doesn’t replace it.</p><p><strong>5. I Use AI to Learn, Not Just to Produce</strong></p><p>This is probably the biggest difference between using AI as a junior developer and using it as an experienced developer.</p><p>When I encounter something unfamiliar, I can ask AI to teach me.</p><p>For example:</p><p>“Explain Swift actors to me as if I already understand threads, locks and GCD.”</p><p>That’s a much better learning experience than reading a generic explanation.</p><p>I can progressively go deeper:</p><p>“Now compare actors with serial dispatch queues.”</p><p>Then:</p><p>“Give me a real production scenario where an actor would be preferable.”</p><p>Then:</p><p>“What are the limitations of this approach?”</p><p>The conversation becomes interactive.</p><p>AI becomes a <strong>personal technical tutor</strong>.</p><p><strong>6. What I Don’t Delegate to AI</strong></p><p>There are things I deliberately don’t outsource.</p><p><strong>Architecture</strong></p><p>AI can suggest architectures.</p><p>It doesn’t know the entire history of my codebase unless I provide it.</p><p>And even then, architectural decisions involve organizational and business constraints that aren’t always visible in the code.</p><p><strong>Product Decisions</strong></p><p>AI can suggest solutions.</p><p>It doesn’t know what the product team actually needs unless we tell it.</p><p><strong>Critical Security Decisions</strong></p><p>I don’t blindly trust generated code for security-sensitive functionality.</p><p>Authentication, authorization, encryption, key management and data protection require careful engineering and verification.</p><p><strong>Final Code Review</strong></p><p>AI can assist with code review.</p><p>It doesn’t replace human review.</p><p><strong>7. AI Changes the Role of the Senior Developer</strong></p><p>I don’t think AI makes senior developers less important.</p><p>I think it makes <strong>engineering judgment more important</strong>.</p><p>When writing a simple function takes seconds, the differentiating factor is no longer typing speed.</p><p>The difficult questions become:</p><p>What should we build?</p><p>Why should we build it this way?</p><p>What are the trade-offs?</p><p>What will happen six months from now?</p><p>How will this affect the rest of the system?</p><p>These are engineering questions.</p><p>And they require experience.</p><p><strong>Conclusion</strong></p><p>After years of building iOS applications, I don’t see AI as a replacement for developers.</p><p>I see it as a shift in how we spend our time.</p><p>Less time on repetitive implementation.</p><p>Less time searching through documentation.</p><p>Less time writing boilerplate.</p><p>More time thinking about architecture.</p><p>More time validating assumptions.</p><p>More time solving difficult problems.</p><p>More time focusing on the product and the user.</p><p>For me, the goal isn’t:</p><p><strong>“How can AI write more of my code?”</strong></p><p>The better question is:</p><p><strong>“How can AI help me become a better engineer?”</strong></p><p>And I believe that’s where the real value is.</p><p><em>The future of software development isn’t necessarily about developers writing less code.</em></p><p><em>It’s about developers spending more of their time on the things that require engineering judgment.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6690a166896" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to SwiftData in Swift]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/introduction-to-swiftdata-in-swift-8e8a0c067294?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e8a0c067294</guid>
            <category><![CDATA[iosdevelopement]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swiftdata]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 11:08:50 GMT</pubDate>
            <atom:updated>2025-02-03T11:08:50.887Z</atom:updated>
            <content:encoded><![CDATA[<p>SwiftData is a powerful and intuitive data persistence framework in Swift that simplifies data storage and retrieval.</p><p>It provides an easy way to manage data models, perform CRUD (Create, Read, Update, Delete) operations, and sync data across devices.</p><p>In this article, we will explore how to use SwiftData effectively with a practical example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULp5OEDYibK8Wg8p91ZiwA.jpeg" /></figure><h3>Why Use SwiftData?</h3><p>SwiftData offers several benefits for Swift developers:</p><ul><li><strong>Seamless integration with SwiftUI</strong></li><li><strong>Automatic data persistence</strong></li><li><strong>Efficient data queries</strong></li><li><strong>Minimal boilerplate code</strong></li></ul><h3>Setting Up SwiftData</h3><p>To get started with SwiftData, follow these steps:</p><ol><li><strong>Import SwiftData Framework</strong></li><li><strong>Define a Data Model</strong></li><li><strong>Use SwiftData to Store and Retrieve Data</strong></li></ol><h3>Step 1: Import SwiftData</h3><p>Before using SwiftData, make sure to import the necessary framework in your project:</p><pre>import SwiftData</pre><h3>Step 2: Define a Data Model</h3><p>A data model represents the structure of your data. In SwiftData, you can define a model using a simple struct or class.</p><pre>@Model<br>class Person {<br>    var id: UUID<br>    var name: String<br>    var age: Int<br>    <br>    init(name: String, age: Int) {<br>        self.id = UUID()<br>        self.name = name<br>        self.age = age<br>    }<br>}</pre><h3>Step 3: Using SwiftData for Data Persistence</h3><p>Now, let’s see how to use SwiftData in a SwiftUI app to manage persons.</p><h4>Creating a SwiftData Container</h4><p>To store and manage data, you need a SwiftData container. You can create it in your SwiftUI app:</p><pre>@main<br>struct MyApp: App {<br>    var body: some Scene {<br>        WindowGroup {<br>            ContentView()<br>                .modelContainer(for: Person.self) // Attach the model container for Person<br>        }<br>    }<br>}</pre><h4>Using SwiftData in a View</h4><p>In SwiftUI, you can use SwiftData to fetch and modify data:</p><pre>struct ContentView: View {<br>    @Environment(\.modelContext) private var modelContext // Access the model context<br>    @Query private var persons: [Person] // Fetch the list of persons<br><br>    var body: some View {<br>        VStack {<br>            List {<br>                ForEach(persons) { person in<br>                    HStack {<br>                        Text(person.name)<br>                        Spacer()<br>                        Text(&quot;Age: \(person.age)&quot;)<br>                    }<br>                }<br>            }<br>            Button(&quot;Add Person&quot;) {<br>                let newPerson = Person(name: &quot;New Person&quot;, age: 30)<br>                modelContext.insert(newPerson)<br>            }<br>        }<br>    }<br>}</pre><h3>CRUD Operations in SwiftData</h3><h3>Creating Data</h3><p>To create a new object and save it:</p><pre>let newPerson = Person(name: &quot;John Doe&quot;, age: 25)<br>modelContext.insert(newPerson) // Insert it into the model context</pre><h3>Reading Data</h3><p>Fetching data is as simple as using the @Query property wrapper in SwiftUI:</p><pre>@Query private var persons: [Person]</pre><h3>Updating Data</h3><p>To update an existing record:</p><pre>if let person = persons.first {<br>    person.age = 35<br>    try? modelContext.save()<br>}</pre><h3>Deleting Data</h3><p>To delete an object:</p><pre>if let person = persons.first {<br>    modelContext.delete(person) // Remove the person from the model context<br>}</pre><h3>Conclusion</h3><p>SwiftData is a robust and easy-to-use framework for handling data persistence in Swift. By leveraging SwiftData with SwiftUI, developers can build powerful apps with minimal effort. Whether you’re working with simple data models or complex relationships, SwiftData makes data management seamless and efficient.</p><p>Would you like to see advanced examples, such as filtering and sorting data? Let us know in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e8a0c067294" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concurrency in iOS: A Developer’s Guide]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/concurrency-in-ios-a-developers-guide-704cf737d52f?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/704cf737d52f</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[asyncawait]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 10:23:26 GMT</pubDate>
            <atom:updated>2025-01-27T10:23:26.267Z</atom:updated>
            <content:encoded><![CDATA[<p>Concurrency is a critical concept for iOS developers, enabling apps to perform multiple tasks simultaneously, such as fetching data, updating UI, and processing user interactions without blocking the main thread. This guide will dive into the various types of concurrency in iOS, providing code examples and best practices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ncHLpmhYi-bh0jm9G3Wb6w.jpeg" /></figure><h3>Why Concurrency Matters</h3><p>Concurrency allows applications to:</p><ul><li><strong>Maintain smooth UI experiences</strong> by running heavy tasks in the background.</li><li><strong>Improve performance</strong> through parallel processing.</li><li><strong>Handle multiple asynchronous events</strong> effectively.</li></ul><p>For example, when fetching data from an API, we don’t want the app’s UI to freeze. Concurrency ensures that users can continue interacting with the app while the data is being fetched.</p><h3>Concurrency APIs in iOS</h3><p>Apple provides multiple APIs to manage concurrency:</p><h3>1. Grand Central Dispatch (GCD)</h3><p>GCD is a low-level API that provides a way to manage tasks via <strong>dispatch queues</strong>. It’s lightweight and offers fine-grained control over task execution.</p><h4>Example: Using GCD for Background Tasks</h4><pre>DispatchQueue.global(qos: .background).async {<br>    // Heavy computation or network request<br>    let result = performHeavyTask()<br><br>    DispatchQueue.main.async {<br>        // Update the UI with the result<br>        self.resultLabel.text = result<br>    }<br>}</pre><ul><li>DispatchQueue.global(qos: .background): Executes the task on a background thread.</li><li>DispatchQueue.main.async: Updates the UI on the main thread.</li></ul><h3>2. Operation Queues</h3><p>In iOS, OperationQueue is a powerful and flexible class that helps manage the execution of concurrent operations. It works with Operation objects (or its subclass, BlockOperation) to perform tasks asynchronously.</p><h3>Key Concepts:</h3><ol><li><strong>Operation</strong>: This is an abstract class that represents a unit of work. You can subclass Operation or use BlockOperation to define custom tasks. Operations are typically used to encapsulate a piece of work that you want to run concurrently or serially.</li><li><strong>OperationQueue</strong>: This class manages a collection of Operation objects and handles their execution, either concurrently or serially. It takes care of the task execution lifecycle, including dependencies, prioritization, and concurrency management.</li></ol><h3>How OperationQueue Works:</h3><ul><li><strong>Concurrency</strong>: By default, an OperationQueue can run multiple operations concurrently. The number of concurrent operations is controlled by the maxConcurrentOperationCount property. You can set it to a specific number to limit how many operations run at the same time, or set it to OperationQueue.defaultMaxConcurrentOperationCount to let the system decide.</li><li><strong>Dependencies</strong>: Operations can be dependent on other operations, meaning one operation won’t start until another operation finishes. You can create dependencies using the addDependency(_:) method. This is useful when you need to ensure that certain operations are completed in a specific order.</li><li><strong>Prioritization</strong>: You can set the priority of an operation using the queuePriority property, which allows for finer control over which operations should execute first. Priority levels range from .veryLow to .veryHigh, but note that the system doesn’t guarantee exact execution order based on priority.</li><li><strong>Completion Block</strong>: Each operation can have a completion block, which is executed once the operation finishes. This is helpful for chaining tasks or updating UI after the operation is done.</li></ul><pre>import Foundation<br><br>// Define a custom operation that simulates downloading a file<br>class DownloadOperation: Operation {<br>    let fileName: String<br>    var downloadSuccessful = false<br>    <br>    init(fileName: String) {<br>        self.fileName = fileName<br>    }<br>    <br>    override func main() {<br>        // Check if the operation is cancelled before starting<br>        if isCancelled {<br>            print(&quot;\(fileName) download was cancelled.&quot;)<br>            return<br>        }<br>        <br>        print(&quot;Downloading \(fileName)...&quot;)<br>        <br>        // Simulate download with a delay<br>        sleep(2) // Simulating time-consuming download task<br>        <br>        // Simulate success or failure randomly<br>        downloadSuccessful = Bool.random()<br>        <br>        if downloadSuccessful {<br>            print(&quot;\(fileName) downloaded successfully.&quot;)<br>        } else {<br>            print(&quot;\(fileName) failed to download.&quot;)<br>        }<br>        <br>        // Check for cancellation after the task<br>        if isCancelled {<br>            print(&quot;\(fileName) download was cancelled after completion.&quot;)<br>        }<br>    }<br>}<br><br>// Create an OperationQueue to manage our operations<br>let downloadQueue = OperationQueue()<br><br>// Set the maximum number of concurrent operations<br>downloadQueue.maxConcurrentOperationCount = 2 // This will allow 2 downloads to happen at the same time<br><br>// Create download operations<br>let downloadFile1 = DownloadOperation(fileName: &quot;File1&quot;)<br>let downloadFile2 = DownloadOperation(fileName: &quot;File2&quot;)<br>let downloadFile3 = DownloadOperation(fileName: &quot;File3&quot;)<br>let downloadFile4 = DownloadOperation(fileName: &quot;File4&quot;)<br><br>// Create dependencies (e.g., File3 depends on File1, and File4 depends on File2)<br>downloadFile3.addDependency(downloadFile1) // File3 will start only after File1 finishes<br>downloadFile4.addDependency(downloadFile2) // File4 will start only after File2 finishes<br><br>// Add completion blocks to handle what happens after each operation completes<br>downloadFile1.completionBlock = {<br>    if downloadFile1.downloadSuccessful {<br>        print(&quot;Completion Block: \(downloadFile1.fileName) was downloaded successfully!&quot;)<br>    } else {<br>        print(&quot;Completion Block: \(downloadFile1.fileName) download failed.&quot;)<br>    }<br>}<br><br>downloadFile2.completionBlock = {<br>    if downloadFile2.downloadSuccessful {<br>        print(&quot;Completion Block: \(downloadFile2.fileName) was downloaded successfully!&quot;)<br>    } else {<br>        print(&quot;Completion Block: \(downloadFile2.fileName) download failed.&quot;)<br>    }<br>}<br><br>downloadFile3.completionBlock = {<br>    if downloadFile3.downloadSuccessful {<br>        print(&quot;Completion Block: \(downloadFile3.fileName) was downloaded successfully!&quot;)<br>    } else {<br>        print(&quot;Completion Block: \(downloadFile3.fileName) download failed.&quot;)<br>    }<br>}<br><br>downloadFile4.completionBlock = {<br>    if downloadFile4.downloadSuccessful {<br>        print(&quot;Completion Block: \(downloadFile4.fileName) was downloaded successfully!&quot;)<br>    } else {<br>        print(&quot;Completion Block: \(downloadFile4.fileName) download failed.&quot;)<br>    }<br>}<br><br>// Add operations to the queue<br>downloadQueue.addOperations([downloadFile1, downloadFile2, downloadFile3, downloadFile4], waitUntilFinished: false)<br><br>// Optional: Cancel File2&#39;s download after 3 seconds to simulate a cancel scenario<br>DispatchQueue.main.asyncAfter(deadline: .now() + 3) {<br>    downloadFile2.cancel() // File2&#39;s download will be cancelled<br>    print(&quot;Cancelling File2 download...&quot;)<br>}</pre><h3>Explanation of the Code:</h3><ol><li><strong>DownloadOperation Class</strong>: This class simulates a file download. It uses the main() method to simulate a download task with a random success or failure outcome. It checks for cancellation at both the start and after the task is done.</li><li><strong>OperationQueue</strong>: We create a queue (downloadQueue) to manage the download operations. We set maxConcurrentOperationCount = 2 to limit the number of concurrent downloads to 2. This ensures that only two downloads happen at the same time, and the rest will wait in the queue.</li><li><strong>Dependencies</strong>: We set dependencies between operations:</li></ol><ul><li>downloadFile3 will only start after downloadFile1 finishes.</li><li>downloadFile4 will only start after downloadFile2 finishes.</li></ul><p><strong>4. Completion Blocks</strong>: Each download operation has a completion block that gets called after the download finishes. It checks whether the download was successful and prints the result.</p><p><strong>5. Cancel Scenario</strong>: After 3 seconds, we simulate a cancellation of downloadFile2 using cancel(). If this operation is running, it will stop early and print that it was cancelled.</p><h3>3. Swift Concurrency (Async/Await)</h3><p>Introduced in Swift 5.5, async/await simplifies asynchronous programming by making it look synchronous. It’s built on top of GCD but provides a more modern and readable approach.</p><h3>Key Concepts of async/await:</h3><ol><li><strong>async</strong>: When a function is marked as async, it indicates that the function is asynchronous and will return a result at some point in the future. You must call such functions using await.</li><li><strong>await</strong>: When you use await, you are telling the program to wait for the result of an asynchronous function before proceeding. await only works inside an async function.</li><li><strong>Concurrency</strong>: async/await helps you to write asynchronous code without dealing with callbacks, closures, or completion handlers manually, making it much easier to write and maintain concurrent code.</li></ol><h3>Example: Fetching Data Asynchronously with async/await</h3><p>Here’s a basic example where we simulate fetching data from a network asynchronously and handle it using async/await.</p><pre>func fetchData() async throws -&gt; [String] {<br>    let url = URL(string: &quot;https://api.example.com/data&quot;)!<br>    let (data, _) = try await URLSession.shared.data(from: url)<br>    return try JSONDecoder().decode([String].self, from: data)<br>}<br><br>Task {<br>    do {<br>        let data = try await fetchData()<br>        print(&quot;Data: \(data)&quot;)<br>    } catch {<br>        print(&quot;Error: \(error)&quot;)<br>    }<br>}</pre><h3>4. Semaphores</h3><p>A DispatchSemaphore is used to manage access to a resource across multiple threads in Swift. It works by maintaining a count, which is initialized to a specific value. When a thread waits for a semaphore, it decreases the count, and when it signals the semaphore, it increases the count.</p><p>Here’s a simple example to demonstrate how DispatchSemaphore can be used to synchronize access to a resource:</p><pre>let semaphore = DispatchSemaphore(value: 2) // Allows 2 concurrent tasks<br><br>DispatchQueue.global().async {<br>    semaphore.wait()<br>    performTaskOne()<br>    semaphore.signal()<br>}<br><br>DispatchQueue.global().async {<br>    semaphore.wait()<br>    performTaskTwo()<br>    semaphore.signal()<br>}</pre><p>The semaphore ensures that at most two tasks can run concurrently.</p><h3>5. NSLock</h3><p>NSLock is a simple locking mechanism that ensures only one thread can execute a critical section of code at a time.</p><h4>Example: Using NSLock</h4><pre>import Foundation<br><br>// Create an NSLock instance<br>let lock = NSLock()<br><br>var sharedCounter = 0<br><br>// A function to safely increment the counter<br>func incrementCounter() {<br>    lock.lock() // Lock the resource<br>    <br>    sharedCounter += 1 // Critical section<br>    print(&quot;Counter incremented to \(sharedCounter)&quot;)<br>    <br>    lock.unlock() // Unlock the resource<br>}<br><br>// Call incrementCounter multiple times to simulate concurrency<br>incrementCounter()<br>incrementCounter()<br>incrementCounter()<br><br>// Output after calling the function 3 times<br>// Output will be:<br>// Counter incremented to 1<br>// Counter incremented to 2<br>// Counter incremented to 3</pre><h3>Key Points:</h3><ul><li><strong>Locking and Unlocking</strong>: The lock.lock() and lock.unlock() ensure that only one thread can increment the sharedCounter at a time.</li><li><strong>Thread-Safe Increment</strong>: Even if you extend this example to multiple threads, using NSLock would prevent race conditions and ensure that the counter is safely updated.</li></ul><h3>6. Actors</h3><p>Actors, introduced in Swift 5.5, provide a safe way to work with mutable state in a concurrent environment. They ensure that only one thread accesses their properties or methods at a time.</p><h4>Example: Using Actors</h4><pre>actor Counter {<br>    private var value = 0<br><br>    func increment() {<br>        value += 1<br>    }<br><br>    func getValue() -&gt; Int {<br>        return value<br>    }<br>}<br><br>let counter = Counter()<br><br>Task {<br>    await counter.increment()<br>    let value = await counter.getValue()<br>    print(&quot;Counter value: \(value)&quot;)<br>}</pre><p>Actors simplify managing shared mutable state by handling synchronization internally.</p><h3>Conclusion</h3><p>By mastering these concurrency tools, you’ll build iOS apps that are performant, responsive, and a joy to use.</p><p>Whether you’re optimizing a single background task or handling complex reactive streams, the right concurrency approach will elevate your development skills.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=704cf737d52f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Handle Gestures in SwiftUI]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/how-to-handle-gestures-in-swiftui-d2f077daaa49?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2f077daaa49</guid>
            <category><![CDATA[iosdevelopement]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 20:09:10 GMT</pubDate>
            <atom:updated>2025-01-16T20:09:10.113Z</atom:updated>
            <content:encoded><![CDATA[<p>SwiftUI provides a declarative way to build user interfaces, and handling gestures is no exception.By using built-in gesture modifiers and APIs, you can easily add interactivity to your app.</p><p>In this article, we’ll explore how to work with gestures in SwiftUI and create dynamic user experiences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*va-WN5wFepDniYWNPisFIg.jpeg" /></figure><h3>Common Gestures in SwiftUI</h3><p>SwiftUI supports a variety of gestures that you can add to your views. Some of the most common ones include:</p><ol><li><strong>Tap Gesture</strong></li><li><strong>Double Tap Gesture</strong></li><li><strong>Long Press Gesture</strong></li><li><strong>Drag Gesture</strong></li><li><strong>Magnification Gesture</strong> (for pinch-to-zoom)</li><li><strong>Rotation Gesture</strong></li></ol><p>Each gesture can be applied using the .gesture() modifier or other convenience methods.</p><h3>Using Tap Gesture</h3><p>The TapGesture is used to detect single or multiple taps on a view.</p><pre>struct TapGestureExample: View {<br>    @State private var tapCount = 0<br><br>    var body: some View {<br>        Text(&quot;Tapped \(tapCount) times&quot;)<br>            .padding()<br>            .background(Color.blue)<br>            .foregroundColor(.white)<br>            .onTapGesture {<br>                tapCount += 1<br>            }<br>    }<br>}</pre><p>Here, the .onTapGesture modifier increments the tap count every time the user taps on the Text view.</p><h3>Using Double Tap Gesture</h3><p>A Double Tap Gesture detects when the user taps twice quickly on a view.</p><pre>struct DoubleTapGestureExample: View {<br>    @State private var isLiked = false<br><br>    var body: some View {<br>        Image(systemName: isLiked ? &quot;heart.fill&quot; : &quot;heart&quot;)<br>            .resizable()<br>            .frame(width: 100, height: 100)<br>            .foregroundColor(isLiked ? .red : .gray)<br>            .onTapGesture(count: 2) {<br>                isLiked.toggle()<br>            }<br>    }<br>}</pre><p>In this example, the heart icon changes color when the user performs a double tap.</p><h3>Using Long Press Gesture</h3><p>A LongPressGesture detects when the user presses and holds a view for a certain duration.</p><pre>struct LongPressGestureExample: View {<br>    @State private var isPressed = false<br><br>    var body: some View {<br>        Circle()<br>            .fill(isPressed ? Color.green : Color.red)<br>            .frame(width: 100, height: 100)<br>            .gesture(<br>                LongPressGesture(minimumDuration: 1.0)<br>                    .onEnded { _ in<br>                        isPressed.toggle()<br>                    }<br>            )<br>    }<br>}</pre><p>In this example, the circle changes color when the user performs a long press.</p><h3>Using Drag Gesture</h3><p>The DragGesture tracks the movement of the user’s finger across the screen. This is particularly useful for draggable views.</p><pre>struct DragGestureExample: View {<br>    @State private var offset = CGSize.zero<br><br>    var body: some View {<br>        Circle()<br>            .fill(Color.blue)<br>            .frame(width: 100, height: 100)<br>            .offset(offset)<br>            .gesture(<br>                DragGesture()<br>                    .onChanged { gesture in<br>                        offset = gesture.translation<br>                    }<br>                    .onEnded { _ in<br>                        offset = .zero<br>                    }<br>            )<br>    }<br>}</pre><p>In this example, the circle moves with the user’s finger and resets its position when the drag ends.</p><h3>Using Magnification Gesture</h3><p>The MagnificationGesture allows you to detect pinch-to-zoom gestures.</p><pre>struct MagnificationGestureExample: View {<br>    @State private var scale: CGFloat = 1.0<br><br>    var body: some View {<br>        Image(systemName: &quot;photo&quot;)<br>            .resizable()<br>            .scaledToFit()<br>            .frame(width: 200, height: 200)<br>            .scaleEffect(scale)<br>            .gesture(<br>                MagnificationGesture()<br>                    .onChanged { value in<br>                        scale = value<br>                    }<br>            )<br>    }<br>}</pre><p>Here, the scaleEffect modifies the size of the image based on the user’s pinch gesture.</p><h3>Using Rotation Gesture</h3><p>The RotationGesture detects rotation movements, often used with two fingers.</p><pre>struct RotationGestureExample: View {<br>    @State private var angle: Angle = .zero<br><br>    var body: some View {<br>        Text(&quot;Rotate Me&quot;)<br>            .padding()<br>            .background(Color.orange)<br>            .rotationEffect(angle)<br>            .gesture(<br>                RotationGesture()<br>                    .onChanged { value in<br>                        angle = value<br>                    }<br>            )<br>    }<br>}</pre><p>In this example, the text rotates as the user performs a rotation gesture.</p><h3>Combining Gestures</h3><p>You can combine multiple gestures using the .simultaneousGesture or .highPriorityGesture modifiers. For example:</p><pre>struct CombinedGestureExample: View {<br>    @State private var isPressed = false<br>    @State private var offset = CGSize.zero<br><br>    var body: some View {<br>        Circle()<br>            .fill(isPressed ? Color.green : Color.blue)<br>            .frame(width: 100, height: 100)<br>            .offset(offset)<br>            .gesture(<br>                DragGesture()<br>                    .onChanged { gesture in<br>                        offset = gesture.translation<br>                    }<br>            )<br>            .simultaneousGesture(<br>                LongPressGesture()<br>                    .onEnded { _ in<br>                        isPressed.toggle()<br>                    }<br>            )<br>    }<br>}</pre><p>Here, the circle can both move (drag) and change color (long press) simultaneously.</p><h3>Why Use Gestures in SwiftUI?</h3><p>Gestures make your app more interactive and engaging. SwiftUI’s declarative syntax allows you to:</p><ul><li>Add gestures with minimal code.</li><li>Combine gestures to create complex interactions.</li><li>Easily customize behavior and handle user input dynamically.</li></ul><p>By mastering gestures, you can create user experiences that feel natural and intuitive.</p><h3>Conclusion</h3><p>SwiftUI’s gesture system is both powerful and flexible. With just a few lines of code, you can handle taps, drags, zooms, and rotations to make your app more dynamic.</p><p>Try these examples in your own projects to explore the possibilities of gesture handling in SwiftUI!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2f077daaa49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effective Communication Between Development Team Members]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/effective-communication-between-development-team-members-6699e389a2ef?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6699e389a2ef</guid>
            <category><![CDATA[iosdevelopement]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[communication-skills]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[développement-personnel]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 10:24:21 GMT</pubDate>
            <atom:updated>2025-01-14T10:24:21.237Z</atom:updated>
            <content:encoded><![CDATA[<p>In software development, collaboration is the cornerstone of success. While technical skills and coding expertise are crucial, effective communication between team members plays an equally significant role in achieving project goals.</p><p>Without clear, structured, and open channels of communication, even the best technical teams can struggle to deliver high-quality products.</p><p>In this article, we’ll explore strategies to improve communication within development teams and ensure smoother collaboration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4uwtyP1R4X3yP3eyDq3VA.jpeg" /></figure><h3>1. The Importance of Communication in Development Teams</h3><p>Development teams often consist of individuals with diverse expertise: front-end developers, back-end engineers, QA testers, designers, and project managers. Each member brings unique insights and skills, but these can only be leveraged when communication bridges the gaps between roles.</p><p>Good communication:</p><ul><li>Reduces misunderstandings and errors.</li><li>Enhances team cohesion and morale.</li><li>Speeds up decision-making and problem resolution.</li><li>Ensures alignment with project goals and timelines.</li></ul><h3>2. Key Principles of Effective Communication</h3><h4>a. Clarity and Conciseness</h4><p>When discussing technical concepts, avoid unnecessary jargon and ambiguity. Use clear language to express ideas, especially when collaborating with team members from non-technical backgrounds.</p><h4>b. Active Listening</h4><p>Communication is a two-way street. Encourage active listening by giving team members the opportunity to voice their opinions without interruptions.</p><h4>c. Transparency</h4><p>Share updates, challenges, and progress openly. Being transparent fosters trust and prevents surprises during critical stages of the project.</p><h4>d. Empathy and Respect</h4><p>Development teams often work under tight deadlines, which can lead to stressful situations. Approach conflicts or feedback with empathy and respect to maintain a positive team environment.</p><h3>3. Tools for Effective Team Communication</h3><h4>a. Real-Time Messaging</h4><p>Platforms like Slack, Microsoft Teams, or Discord facilitate quick, informal conversations. Use these tools for:</p><ul><li>Daily check-ins.</li><li>Sharing quick updates.</li><li>Collaborating on urgent issues.</li></ul><h4>b. Task Management Tools</h4><p>Tools like Jira or Trello help teams track project progress, assign tasks, and stay aligned. Proper usage of these tools ensures transparency and accountability.</p><h4>c. Version Control Systems</h4><p>GitHub, GitLab, or Bitbucket provide a collaborative environment for managing codebases. Features like pull requests and inline comments enable teams to discuss code changes efficiently.</p><h4>d. Video Conferencing</h4><p>For remote teams, video calls are essential for detailed discussions, brainstorming, and building rapport. Regular face-to-face interactions (virtual or in-person) improve team dynamics.</p><h3>4. Best Practices for Team Communication</h3><h4>a. Establish Regular Check-Ins</h4><p>Schedule daily stand-ups or weekly meetings to:</p><ul><li>Review progress.</li><li>Address roadblocks.</li><li>Plan upcoming tasks.</li></ul><h4>b. Use Agile Ceremonies</h4><p>Implement Agile methodologies like Scrum or Kanban to structure communication. Key ceremonies include:</p><ul><li>Sprint planning.</li><li>Retrospectives.</li><li>Demo sessions.</li></ul><h4>c. Document Everything</h4><p>Documentation is critical for long-term success. Use tools like Confluence, Notion, or Google Docs to maintain:</p><ul><li>Technical specifications.</li><li>Meeting notes.</li><li>Onboarding guides.</li></ul><h4>d. Encourage Open Feedback</h4><p>Create an environment where feedback is welcomed and encouraged. Constructive feedback improves the team’s overall performance and helps individuals grow.</p><h3>5. Building a Culture of Communication</h3><p>Effective communication isn’t just about tools and practices; it’s about fostering a culture where collaboration thrives. To build such a culture:</p><ul><li>Lead by example: Managers and senior developers should model open communication.</li><li>Celebrate achievements: Recognize individual and team contributions regularly.</li><li>Encourage diversity: Diverse perspectives lead to innovative solutions.</li><li>Invest in training: Provide workshops on communication skills, conflict resolution, and emotional intelligence.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x8EMTP0LAHfC0_MWetNu5A.jpeg" /></figure><h3>Conclusion</h3><p>In a fast-paced development environment, communication can make or break a team’s success.</p><p>By adopting clear practices, leveraging the right tools, and fostering a culture of openness, development teams can work more effectively, innovate faster, and deliver outstanding results.</p><p>Remember: great products are built by great teams — and great teams are built on strong communication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6699e389a2ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI’s LazyVStack vs. VStack: Key Differences and When to Use Each]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/swiftuis-lazyvstack-vs-vstack-key-differences-and-when-to-use-each-3012500ee590?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3012500ee590</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Mon, 13 Jan 2025 14:45:13 GMT</pubDate>
            <atom:updated>2025-01-13T14:45:13.454Z</atom:updated>
            <content:encoded><![CDATA[<p>SwiftUI provides developers with powerful layout tools to create stunning user interfaces. Among these, VStack and LazyVStack are essential for arranging views vertically. While they share similarities in structure and purpose, their behavior differs significantly, especially when dealing with large or dynamic content.</p><p>In this article, we’ll explore the differences between VStack and LazyVStack, highlight their use cases, and provide practical examples to help you decide which one to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRQodlEHv6phAkB6qbP0bQ.jpeg" /><figcaption>Here is the image depicting the difference between VStack and LazyVStack in SwiftUI. It visually compares the simple vertical stack with a VStack on the left and a dynamic LazyVStack on the right, showing how the objects are lazily loaded as you scroll.</figcaption></figure><h3>What is a VStack?</h3><p>VStack is a basic vertical stack container in SwiftUI. It lays out its child views vertically, one after the other. All views inside a VStack are rendered <strong>immediately</strong> and occupy memory, regardless of whether they’re visible on the screen.</p><h4>Key Characteristics of VStack:</h4><ol><li><strong>Eager Loading</strong>: All child views are created and rendered upfront, even if they’re offscreen.</li><li><strong>Performance Considerations</strong>: When dealing with a large number of views, this can lead to high memory usage and degraded performance.</li><li><strong>Use Case</strong>: Best for a small, fixed number of views.</li></ol><h4>Example of VStack:</h4><pre>import SwiftUI<br><br>struct ContentView: View {<br>    var body: some View {<br>        VStack(alignment: .center, spacing: 20) {<br>            ForEach(0..&lt;50, id: \ .self) { index in<br>                Text(&quot;Item \(index)&quot;)<br>                    .padding()<br>                    .background(Color.blue.opacity(0.3))<br>            }<br>        }<br>    }<br>}</pre><p>This VStack will eagerly load and render all 50 Text views, regardless of whether they’re currently visible on the screen.</p><h3>What is a LazyVStack?</h3><p>LazyVStack is a more performance-oriented counterpart to VStack. It <strong>lazily loads</strong> its child views, creating and rendering them only when they’re about to appear on the screen. This makes it ideal for handling large or dynamic data sets.</p><h4>Key Characteristics of LazyVStack:</h4><ol><li><strong>Lazy Loading</strong>: Child views are created on demand, conserving memory and improving performance.</li><li><strong>Scroll Container Compatibility</strong>: Typically used within a ScrollView to enable lazy loading.</li><li><strong>Use Case</strong>: Ideal for large or infinite lists where rendering all views upfront would be inefficient.</li></ol><h4>Example of LazyVStack:</h4><pre>import SwiftUI<br><br>struct ContentView: View {<br>    var body: some View {<br>        ScrollView {<br>            LazyVStack(alignment: .center, spacing: 20) {<br>                ForEach(0..&lt;1000, id: \ .self) { index in<br>                    Text(&quot;Lazy Item \(index)&quot;)<br>                        .padding()<br>                        .background(Color.green.opacity(0.3))<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>In this example, the LazyVStack will only create and render the views that are visible within the ScrollView, significantly reducing memory usage for a large dataset.</p><h3>Key Differences Between VStack and LazyVStack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buK5EExvFL15eDDQi213XA.png" /></figure><h3>When to Use VStack</h3><p>Choose VStack if:</p><ul><li>You have a <strong>small number of child views</strong>.</li><li>All views are <strong>static</strong> and always need to be rendered.</li><li>Performance is not a concern.</li></ul><h4>Example:</h4><pre>VStack {<br>    Text(&quot;Welcome&quot;)<br>        .font(.largeTitle)<br>    Text(&quot;SwiftUI VStack Example&quot;)<br>        .font(.headline)<br>}</pre><h3>When to Use LazyVStack</h3><p>Choose LazyVStack if:</p><ul><li>You’re dealing with a <strong>large dataset</strong> (e.g., 1,000+ items).</li><li>Views are displayed inside a ScrollView.</li><li>You want to optimize <strong>memory usage</strong> and <strong>performance</strong>.</li></ul><h4>Example:</h4><pre>ScrollView {<br>    LazyVStack {<br>        ForEach(1..&lt;1001, id: \ .self) { index in<br>            Text(&quot;Dynamic Item \(index)&quot;)<br>        }<br>    }<br>}</pre><h3>Combining VStack and LazyVStack</h3><p>In some cases, you may want to combine both VStack and LazyVStack in the same layout. For example, static content at the top and lazy-loaded content below:</p><pre>import SwiftUI<br><br>struct ContentView: View {<br>    var body: some View {<br>        ScrollView {<br>            VStack {<br>                Text(&quot;Static Header&quot;)<br>                    .font(.title)<br><br>                LazyVStack {<br>                    ForEach(0..&lt;1000, id: \ .self) { index in<br>                        Text(&quot;Lazy Loaded Item \(index)&quot;)<br>                            .padding()<br>                            .background(Color.orange.opacity(0.3))<br>                    }<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>Here, the VStack renders the static header immediately, while the LazyVStack ensures the list items are only loaded when needed.</p><h3>Conclusion</h3><p>Understanding the differences between VStack and LazyVStack is crucial for optimizing performance in your SwiftUI apps.</p><p>Use VStack for small, static content, and switch to LazyVStack for large or dynamic datasets to keep your app responsive and efficient.</p><p>By choosing the right stack for your use case, you can deliver smooth and performant user experiences, even with complex layouts. Experiment with both to find the perfect balance for your app!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3012500ee590" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Code Review: A Guide for Teams]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/the-art-of-code-review-a-guide-for-teams-94074be02977?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/94074be02977</guid>
            <category><![CDATA[team-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[codereviewtips]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Mon, 06 Jan 2025 19:17:05 GMT</pubDate>
            <atom:updated>2025-01-06T19:17:05.102Z</atom:updated>
            <content:encoded><![CDATA[<p>Code reviews are a critical part of software development, enabling teams to maintain high code quality, share knowledge, and foster collaboration.</p><p>But conducting code reviews effectively requires more than just pointing out bugs. This guide outlines the best practices for running impactful code reviews in your development team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40q4oeXOfiwBFTh-sTDrOw.jpeg" /></figure><h3>1. Establish a Code Review Culture</h3><p>Before diving into specifics, it’s essential to create a culture that values code reviews as a collaborative, non-judgmental process. Team members should:</p><ul><li>Understand that reviews aim to improve the code, not criticize the coder.</li><li>Appreciate feedback as an opportunity for growth.</li><li>Respect each other’s time and expertise.</li></ul><p>Promoting a positive mindset ensures that reviews are productive and not a source of friction.</p><h3>2. Define Clear Guidelines</h3><p>Create a set of rules and expectations for code reviews to avoid ambiguity. These guidelines should include:</p><ul><li><strong>Standards:</strong> Define coding standards and conventions the team should follow.</li><li><strong>Tools:</strong> Use tools like GitHub, GitLab, or Bitbucket for pull requests and inline comments.</li><li><strong>Scope:</strong> Specify what reviewers should focus on, such as functionality, readability, security, and performance.</li></ul><p>Providing a checklist can help reviewers systematically evaluate code:</p><ul><li>Is the code easy to read and understand?</li><li>Does it adhere to team conventions?</li><li>Are there adequate comments and documentation?</li><li>Are edge cases and potential bugs accounted for?</li></ul><h3>3. Use Pull Requests Effectively</h3><p>Pull requests (PRs) are the heart of the review process. To make PRs efficient:</p><ul><li><strong>Keep them Small:</strong> Large PRs are harder to review and more error-prone. Encourage developers to submit smaller, manageable changes.</li><li><strong>Provide Context:</strong> Include a clear description of what the code does and why it’s necessary. Link to any related tickets or documentation.</li><li><strong>Set Deadlines:</strong> Define a timeline for reviews to prevent blocking progress.</li></ul><h3>4. Be a Thoughtful Reviewer</h3><p>As a reviewer, your role is not just to find errors but to help the author grow as a developer. Follow these tips:</p><ul><li><strong>Be Constructive:</strong> Frame feedback positively. Instead of saying, “This is wrong,” say, “Consider this alternative to improve readability.”</li><li><strong>Ask Questions:</strong> If something is unclear, ask the author to clarify rather than assuming it’s incorrect.</li><li><strong>Balance Praise and Criticism:</strong> Highlight what’s done well to motivate team members.</li></ul><h3>5. Empower the Author</h3><p>The author of the code should remain in control of their work. Encourage them to:</p><ul><li><strong>Address Feedback:</strong> Respond to comments promptly and explain their reasoning if they disagree.</li><li><strong>Update the Code:</strong> Make necessary changes and request a follow-up review if needed.</li><li><strong>Learn and Reflect:</strong> Use feedback as a learning opportunity to improve future contributions.</li></ul><h3>6. Use Automation to Reduce Manual Work</h3><p>Automated tools can handle repetitive checks, allowing reviewers to focus on higher-level concerns. Consider using:</p><ul><li><strong>Static Analysis Tools:</strong> To catch syntax errors and enforce coding standards.</li><li><strong>CI/CD Pipelines:</strong> To ensure all tests pass before a PR is merged.</li><li><strong>Linting Tools:</strong> To maintain consistent formatting.</li></ul><h3>7. Avoid Common Pitfalls</h3><p>Here are some mistakes to watch out for:</p><ul><li><strong>Too Much Focus on Style:</strong> Tools like linters can handle formatting issues; reviewers should prioritize functionality and logic.</li><li><strong>Delays in Feedback:</strong> Slow reviews can block progress. Aim to review PRs within 1–2 business days.</li><li><strong>Personal Criticism:</strong> Feedback should be about the code, not the person writing it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOiJ50qgnzejjv_1fAgAXA.jpeg" /></figure><h3>Conclusion</h3><p>By following these best practices, your team can transform code reviews from a mundane chore into a valuable opportunity for learning and collaboration.</p><p>Remember, the ultimate goal is not just better code but a stronger, more cohesive team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94074be02977" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Navigation in SwiftUI for iOS]]></title>
            <link>https://medium.com/@ines.bokri.belgacem/mastering-navigation-in-swiftui-for-ios-d31e0a3a5366?source=rss-4aa42771362a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d31e0a3a5366</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[iosdevelopement]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Ines BOKRI]]></dc:creator>
            <pubDate>Fri, 03 Jan 2025 16:14:24 GMT</pubDate>
            <atom:updated>2025-01-03T16:14:24.413Z</atom:updated>
            <content:encoded><![CDATA[<p>Navigation is a critical aspect of building user-friendly and intuitive apps, and SwiftUI provides a declarative and powerful way to manage it.</p><p>Whether you’re new to SwiftUI or transitioning from UIKit, understanding its navigation system is essential for crafting great iOS experiences.</p><p>In this article, we’ll explore navigation in SwiftUI, from the basics to advanced use cases.</p><h3>The Basics of Navigation in SwiftUI</h3><p>SwiftUI’s navigation is primarily managed using NavigationView and NavigationLink.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgEY15sFWhL7MBXQgumuTQ.jpeg" /></figure><h4>Setting Up a Navigation View</h4><p>A NavigationView acts as a container for your navigable content. Here’s a simple example:</p><pre>import SwiftUI<br><br>struct ContentView: View {<br>    var body: some View {<br>        NavigationView {<br>            Text(&quot;Welcome to SwiftUI Navigation&quot;)<br>                .navigationTitle(&quot;Home&quot;)<br>        }<br>    }<br>}</pre><p>In this code, NavigationView wraps the Text view, and navigationTitle sets the title for the current screen.</p><h4>Using NavigationLink</h4><p>NavigationLink is used to navigate to another view when tapped. Let’s enhance the previous example:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        NavigationView {<br>            VStack {<br>                NavigationLink(destination: DetailView()) {<br>                    Text(&quot;Go to Details&quot;)<br>                }<br>                .padding()<br>            }<br>            .navigationTitle(&quot;Home&quot;)<br>        }<br>    }<br>}<br><br>struct DetailView: View {<br>    var body: some View {<br>        Text(&quot;This is the detail view.&quot;)<br>            .navigationTitle(&quot;Details&quot;)<br>    }<br>}</pre><p>Here, tapping the “Go to Details” button navigates to DetailView.</p><h3>Advanced Navigation Techniques</h3><h4>Programmatic Navigation</h4><p>In some cases, you may need to navigate programmatically. SwiftUI provides a way to do this using @State and NavigationLink.</p><pre>struct ContentView: View {<br>    @State private var navigateToDetails = false<br><br>    var body: some View {<br>        NavigationView {<br>            VStack {<br>                Button(&quot;Navigate Programmatically&quot;) {<br>                    navigateToDetails = true<br>                }<br>                NavigationLink(destination: DetailView(), isActive: $navigateToDetails) {<br>                    EmptyView()<br>                }<br>            }<br>            .navigationTitle(&quot;Home&quot;)<br>        }<br>    }<br>}</pre><p>When the button is tapped, the navigateToDetails state changes to true, triggering the navigation.</p><h4>Passing Data Between Views</h4><p>You can pass data between views by initializing the destination view with parameters:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        NavigationView {<br>            NavigationLink(destination: DetailView(name: &quot;SwiftUI&quot;)) {<br>                Text(&quot;Learn More About SwiftUI&quot;)<br>            }<br>            .navigationTitle(&quot;Home&quot;)<br>        }<br>    }<br>}<br><br>struct DetailView: View {<br>    let name: String<br><br>    var body: some View {<br>        Text(&quot;You are learning about \(name).&quot;)<br>            .navigationTitle(name)<br>    }<br>}</pre><h3>Navigation in TabView</h3><p>SwiftUI’s TabView is often combined with NavigationView for apps with multiple sections.</p><pre>struct ContentView: View {<br>    var body: some View {<br>        TabView {<br>            NavigationView {<br>                Text(&quot;First Tab&quot;)<br>                    .navigationTitle(&quot;Tab 1&quot;)<br>            }<br>            .tabItem {<br>                Label(&quot;Tab 1&quot;, systemImage: &quot;1.circle&quot;)<br>            }<br><br>            NavigationView {<br>                Text(&quot;Second Tab&quot;)<br>                    .navigationTitle(&quot;Tab 2&quot;)<br>            }<br>            .tabItem {<br>                Label(&quot;Tab 2&quot;, systemImage: &quot;2.circle&quot;)<br>            }<br>        }<br>    }<br>}</pre><h3>Handling Modal Navigation</h3><p>To present views modally, you can use .sheet or .fullScreenCover:</p><pre>struct ContentView: View {<br>    @State private var showModal = false<br><br>    var body: some View {<br>        Button(&quot;Show Modal&quot;) {<br>            showModal = true<br>        }<br>        .sheet(isPresented: $showModal) {<br>            ModalView()<br>        }<br>    }<br>}<br><br>struct ModalView: View {<br>    var body: some View {<br>        Text(&quot;This is a modal view.&quot;)<br>    }<br>}</pre><h3>Customizing Navigation</h3><p>SwiftUI allows for customization of navigation styles and behaviors:</p><h4>Hiding the Back Button</h4><p>You can hide the back button in a navigation view using navigationBarBackButtonHidden(true):</p><pre>struct DetailView: View {<br>    var body: some View {<br>        Text(&quot;Custom Navigation&quot;)<br>            .navigationTitle(&quot;Details&quot;)<br>            .navigationBarBackButtonHidden(true)<br>    }<br>}</pre><h4>Adding Toolbar Items</h4><p>Add additional actions to the navigation bar with toolbar:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        NavigationView {<br>            Text(&quot;Toolbar Example&quot;)<br>                .navigationTitle(&quot;Home&quot;)<br>                .toolbar {<br>                    ToolbarItem(placement: .navigationBarTrailing) {<br>                        Button(&quot;Action&quot;) {<br>                            print(&quot;Action tapped&quot;)<br>                        }<br>                    }<br>                }<br>        }<br>    }<br>}</pre><h3>Best Practices for Navigation in SwiftUI</h3><ol><li><strong>Keep it Declarative:</strong> Embrace SwiftUI’s declarative nature. Avoid trying to replicate UIKit’s imperative patterns.</li><li><strong>Simplify State Management:</strong> Use @State, @Binding, and @ObservedObject to manage navigation-related state effectively.</li><li><strong>Test on Multiple Devices:</strong> Navigation behavior may vary across devices. Always test on different screen sizes.</li><li><strong>Leverage Combine:</strong> If your navigation depends on asynchronous data, integrate Combine for reactive state updates.</li></ol><h3>Conclusion</h3><p>Navigation in SwiftUI is simple to get started with but offers powerful tools for building complex navigation flows. By mastering NavigationView, NavigationLink, and programmatic navigation, you can create polished and user-friendly iOS apps. Combine these techniques with good state management practices, and you’ll be well on your way to SwiftUI navigation mastery.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d31e0a3a5366" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>