<?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 Soumya Ranjan Mishra on Medium]]></title>
        <description><![CDATA[Stories by Soumya Ranjan Mishra on Medium]]></description>
        <link>https://medium.com/@soumyamishra637?source=rss-3c7ee4415058------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lKPZpEfyHmf415Q27lS6vA.jpeg</url>
            <title>Stories by Soumya Ranjan Mishra on Medium</title>
            <link>https://medium.com/@soumyamishra637?source=rss-3c7ee4415058------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:05:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@soumyamishra637/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[CMS-Driven Architecture in iOS (Fintech Edition)]]></title>
            <link>https://medium.com/@soumyamishra637/cms-driven-architecture-in-ios-fintech-edition-a90a7ef1afd8?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/a90a7ef1afd8</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 03:01:01 GMT</pubDate>
            <atom:updated>2026-03-18T03:01:01.022Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Building Scalable, Configurable &amp; Release-Independent Mobile Platforms</strong></p><p>In modern mobile development, especially in large-scale applications like <strong>fintech</strong> speed, flexibility, and remote configurability are critical.</p><p>This is where <strong>CMS-driven architecture</strong> becomes a game changer.</p><h4>What is CMS-Driven Architecture?</h4><p>CMS-driven architecture enables the mobile app to <strong>render UI dynamically based on backend configurations (JSON)</strong> instead of relying on hardcoded layouts.</p><p>The app shows UI based on data, not hardcoded logic.</p><h4>Project Experience (Fintech — American Express Platform)</h4><blockquote>Currently, I am working on a large-scale <strong>fintech mobile platform (American Express)</strong> where we are actively integrating a <strong>CMS-driven architecture</strong> to improve flexibility and scalability.</blockquote><p>In our current fintech system:</p><h4>What we are solving:</h4><ul><li>UI and content are tightly tied to the code, so even minor changes require a full release. This reduces product team flexibility, makes customization harder, and slows down feature delivery across users and regions.</li></ul><h4>What CMS enabled:</h4><ul><li>After CMS integration, UI and content are controlled from the backend, allowing real-time updates, easier customization, and faster feature rollout without app releases.</li></ul><h4>Production-Level Architecture (Clean Architecture + CMS):</h4><pre>CMS (Backend)<br> ↓<br>API Layer (JSON Config)<br> ↓<br>Repository / UseCase<br> ↓<br>ViewModel<br> ↓<br>Dynamic UI Renderer (SwiftUI / UIKit)</pre><h4>Fintech CMS Response (Realistic Example)</h4><pre>{<br>  &quot;user&quot;: {<br>    &quot;name&quot;: &quot;John Doe&quot;,<br>    &quot;age&quot;: 28,<br>    &quot;dob&quot;: &quot;2002-02-04&quot;,<br>    &quot;phone&quot;: &quot;9376543220&quot;,<br>    &quot;email&quot;: &quot;johndoe@example.com&quot;,<br>    &quot;address&quot;: {<br>      &quot;street&quot;: &quot;123 Main Road&quot;,<br>      &quot;city&quot;: &quot;Houston&quot;,<br>      &quot;state&quot;: &quot;Texas&quot;,<br>      &quot;zip&quot;: &quot;77001&quot;<br>    }<br>  }<br>}</pre><blockquote>Here backend sends user data, and the app simply displays it. No hardcoding is needed.</blockquote><blockquote>Code-Level Implementation (SwiftUI + Clean Architecture)</blockquote><p><strong>1. Domain Models:</strong></p><pre>struct UserResponse: Decodable {<br>    let user: User<br>}<br><br>struct User: Decodable {<br>    let name: String<br>    let age: Int<br>    let dob: String<br>    let phone: String<br>    let email: String<br>    let address: Address<br>}<br><br>struct Address: Decodable {<br>    let street: String<br>    let city: String<br>    let state: String<br>    let zip: String<br>}</pre><p><strong>2. API Layer:</strong></p><pre>protocol UserServiceProtocol {<br>    func fetchUser() async throws -&gt; User<br>}<br><br>final class UserService: UserServiceProtocol {<br>    <br>    func fetchUser() async throws -&gt; User {<br>        let url = URL(string: &quot;https://api.example.com/user&quot;)!<br>        let (data, _) = try await URLSession.shared.data(from: url)<br>        <br>        let response = try JSONDecoder().decode(UserResponse.self, from: data)<br>        return response.user<br>    }<br>}</pre><p><strong>3. Repository Layer:</strong></p><pre>protocol UserRepositoryProtocol {<br>    func getUser() async throws -&gt; User<br>}<br><br>final class UserRepository: UserRepositoryProtocol {<br>    <br>    private let service: UserServiceProtocol<br>    <br>    init(service: UserServiceProtocol) {<br>        self.service = service<br>    }<br>    <br>    func getUser() async throws -&gt; User {<br>        return try await service.fetchUser()<br>    }<br>}</pre><p><strong>4. Use Case:</strong></p><pre>final class FetchUserUseCase {<br>    <br>    private let repository: UserRepositoryProtocol<br>    <br>    init(repository: UserRepositoryProtocol) {<br>        self.repository = repository<br>    }<br>    <br>    func execute() async throws -&gt; User {<br>        return try await repository.getUser()<br>    }<br>}</pre><p><strong>5. ViewModel:</strong></p><pre>@MainActor<br>final class ProfileViewModel: ObservableObject {<br>    <br>    @Published var user: User?<br>    @Published var isLoading = false<br>    <br>    private let useCase: FetchUserUseCase<br>    <br>    init(useCase: FetchUserUseCase) {<br>        self.useCase = useCase<br>    }<br>    <br>    func loadUser() {<br>        isLoading = true<br>        <br>        Task {<br>            do {<br>                user = try await useCase.execute()<br>            } catch {<br>                print(&quot;Error fetching user:&quot;, error)<br>            }<br>            isLoading = false<br>        }<br>    }<br>}</pre><p><strong>6. View:</strong></p><pre>struct ProfileView: View {<br>    <br>    @StateObject var viewModel: ProfileViewModel<br>    <br>    var body: some View {<br>        VStack(alignment: .leading, spacing: 12) {<br>            <br>            if let user = viewModel.user {<br>                <br>                Text(&quot;Name: \(user.name)&quot;)<br>                Text(&quot;Age: \(user.age)&quot;)<br>                Text(&quot;DOB: \(user.dob)&quot;)<br>                Text(&quot;Phone: \(user.phone)&quot;)<br>                Text(&quot;Email: \(user.email)&quot;)<br>                <br>                Text(&quot;Address:&quot;)<br>                    .font(.headline)<br>                <br>                Text(user.address.street)<br>                Text(&quot;\(user.address.city), \(user.address.state)&quot;)<br>                Text(&quot;ZIP: \(user.address.zip)&quot;)<br>                <br>            } else if viewModel.isLoading {<br>                ProgressView(&quot;Loading...&quot;)<br>            }<br>        }<br>        .padding()<br>        .onAppear {<br>            viewModel.loadUser()<br>        }<br>    }<br>}</pre><h4><strong>Benefits of CMS-Driven Architecture</strong></h4><ul><li>CMS-driven architecture helps update the app without releasing a new version, making changes faster and easier. It also enables teams to test features, personalize user experiences, and scale the app efficiently based on business needs.</li></ul><blockquote>It is widely used across fintech, e-commerce, and banking apps to manage content, user flows, and features dynamically without changing the app code.</blockquote><h4>Challenges from Current Project Implementation</h4><ul><li>While implementing CMS-driven architecture in a fintech project, a few key challenges I’ve faced include handling dynamic UI mapping for different components, ensuring performance is not impacted due to runtime rendering, and validating backend data to avoid UI crashes. Additionally, managing backward compatibility across app versions and handling feature rollouts smoothly require careful design and testing.</li></ul><blockquote><strong>Best CMS Practices:</strong></blockquote><blockquote>Use strongly typed models (like enums or structs) to handle CMS data and always provide a fallback UI for missing or unexpected data. In fintech apps, ensure data is securely fetched and validated from the backend instead of relying on local storage. Use feature flags for controlled rollouts and keep the code clean and maintainable.</blockquote><h4>Final Thoughts:</h4><p>CMS-driven architecture changes mobile apps from fixed and release-dependent systems into dynamic and backend-driven experiences. It helps teams deliver updates faster, adapt the UI easily, and respond quickly to business needs.</p><pre>Normal App                 CMS-Driven App<br>---------------            ---------------<br>Hardcoded UI          →    Dynamic UI<br>Release for changes   →    Update from backend<br>Developer-driven      →    Business-driven</pre><h3>Let’s Connect</h3><p>If this guide helped you, follow me on <a href="https://github.com/soumya-mishra-97">GitHub</a> and <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> for more mobile development tips!</p><p>Thanks 🙌</p><p>#iOSDevelopment #Swift #SwiftUI #MobileDevelopment #CleanArchitecture<br> #iOSDev #SoftwareEngineering #AppDevelopment #TechBlog #MediumArticle<br> #Fintech #ScalableSystems #SystemDesign #MobileArchitecture #CMS<br> #BackendDrivenUI #FeatureFlags #A_BTesting #DeveloperLife #Coding</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a90a7ef1afd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering SOLID Principles in Swift: The Foundation of Clean Code]]></title>
            <link>https://medium.com/@soumyamishra637/mastering-solid-principles-in-swift-the-foundation-of-clean-code-b416db46d43a?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/b416db46d43a</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[solid-principles]]></category>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Wed, 15 Oct 2025 04:46:21 GMT</pubDate>
            <atom:updated>2025-10-15T13:19:23.495Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“Bad code works. Great code lasts.”<br> — Robert C. Martin (Uncle Bob)</blockquote><p>As developers, we all start by writing code that <em>works</em>.<br>But as our apps grow, so does complexity — new features break old ones, testing becomes painful, and maintenance turns into a nightmare.</p><p>That’s where <strong>SOLID principles</strong> come in.<br>They’re not just buzzwords; they’re the <strong>five golden rules</strong> that make code flexible, testable, and scalable.</p><p>In this article, we’ll explore all <strong>five SOLID principles</strong> in <strong>Swift</strong>, with clear explanations, real-world analogies, and clean code examples.</p><h3>What is SOLID?</h3><h4><strong>1. Single Responsibility Principle (SRP)</strong></h4><blockquote>One class = One reason to change</blockquote><blockquote>Each class has <strong>one reason to change</strong>, which keeps the code clean and testable.</blockquote><p>🚫 Bad Code:</p><pre>class Report {<br>    func generate() { print(&quot;Generating report...&quot;) }<br>    func saveToFile() { print(&quot;Saving to file...&quot;) }<br>    func sendEmail() { print(&quot;Sending email...&quot;) }<br>}</pre><p>In this case, This <strong>Report</strong> class does <strong>too much</strong> — it generates, saves, and sends emails. If we change how emails work, we’re forced to modify this class.</p><p>✅ Correct Code:</p><pre>class Report {<br>    func generate() -&gt; String { &quot;Report data&quot; }<br>}<br><br>class FileStorage {<br>    func save(_ data: String) { print(&quot;Saved to file: \(data)&quot;) }<br>}<br><br>class EmailSender {<br>    func send(_ data: String) { print(&quot;Sent email: \(data)&quot;) }<br>}</pre><p>In this case, Each class has <strong>a single, focused responsibility</strong>. So Testing, debugging, and extending become much easier.</p><h4><strong>2. Open/Closed Principle (OCP)</strong></h4><blockquote>Extend without modifying existing code.</blockquote><blockquote>Classes should be open for extension, but closed for modification.</blockquote><p>🚫 Bad Code:</p><pre>class Payment {<br>    func pay(using method: String) {<br>        if method == &quot;Card&quot; {<br>            print(&quot;Paid with Card&quot;)<br>        } else if method == &quot;UPI&quot; {<br>            print(&quot;Paid with UPI&quot;)<br>        }<br>    }<br>}</pre><p>In this case, Adding a new payment method forces us to <strong>edit existing code</strong>, risking regressions.</p><p>✅ Correct Code:</p><pre>protocol PaymentMethod {<br>    func pay()<br>}<br><br>class CardPayment: PaymentMethod {<br>    func pay() { print(&quot;Paid with Card&quot;) }<br>}<br><br>class UpiPayment: PaymentMethod {<br>    func pay() { print(&quot;Paid with UPI&quot;) }<br>}<br><br>class PaymentProcessor {<br>    func process(payment: PaymentMethod) {<br>        payment.pay()<br>    }<br>}</pre><p>In this case, adding <strong>ApplePay</strong> or <strong>CryptoPayment</strong> is as simple as creating a new class — no modification needed.</p><h4><strong>3. Liskov Substitution Principle (LSP)</strong></h4><blockquote>Subtypes must be replaceable by base types.</blockquote><blockquote>Subclasses should be replaceable for their base classes without breaking functionality.</blockquote><p>🚫 Bad Code:</p><pre>class Bird {<br>    func fly() { print(&quot;Flying...&quot;) }<br>}<br><br>class Ostrich: Bird {<br>    override func fly() {<br>        fatalError(&quot;Ostriches can’t fly!&quot;) // ❌ Violates LSP<br>    }<br>}</pre><p>In this case, <strong>Ostrich</strong> breaks the expectation of <strong>Bird</strong>.</p><p>✅ Correct Code:</p><pre>protocol Bird {<br>    func move()<br>}<br><br>class Sparrow: Bird {<br>    func move() { print(&quot;Flying...&quot;) }<br>}<br><br>class Ostrich: Bird {<br>    func move() { print(&quot;Running...&quot;) }<br>}</pre><p>In this case, both <strong>Sparrow</strong> and <strong>Ostrich</strong> conform to the <strong>Bird</strong> interface correctly.</p><p><strong>Why it matters:</strong> Your code should treat all subclasses the same way without surprises.</p><h4>4. Interface Segregation Principle (ISP)</h4><blockquote>Split large interfaces into smaller ones</blockquote><blockquote>Clients should not be forced to depend on methods they don’t use.</blockquote><p>🚫 Bad Code:</p><pre>protocol Worker {<br>    func work()<br>    func eat()<br>}<br><br>class Robot: Worker {<br>    func work() { print(&quot;Robot working&quot;) }<br>    func eat() { fatalError(&quot;Robots don’t eat!&quot;) }<br>}</pre><p>✅ Correct Code:</p><pre>protocol Workable {<br>    func work()<br>}<br><br>protocol Eatable {<br>    func eat()<br>}<br><br>class Human: Workable, Eatable {<br>    func work() { print(&quot;Human working&quot;) }<br>    func eat() { print(&quot;Human eating&quot;) }<br>}<br><br>class Robot: Workable {<br>    func work() { print(&quot;Robot working&quot;) }<br>}</pre><p>In this case, each type implements <strong>only what it needs</strong>.<br>Smaller interfaces = cleaner, more flexible code.</p><h4>5. Dependency Inversion Principle (DIP)</h4><blockquote>Depend on protocols, not concrete classes.</blockquote><blockquote>Depend on abstractions, not on concrete implementations.</blockquote><p>🚫 Bad Code:</p><pre>class MySQLDatabase {<br>    func save(data: String) {<br>        print(&quot;Saving in MySQL&quot;)<br>    }<br>}<br><br>class UserService {<br>    let db = MySQLDatabase() // ❌ Tightly coupled<br>    func saveUser(_ user: String) {<br>        db.save(data: user)<br>    }<br>}</pre><p>In this case, You can’t easily swap the database or test this code in isolation.</p><p>✅ Correct Code:</p><pre>protocol Database {<br>    func save(data: String)<br>}<br><br>class MySQLDatabase: Database {<br>    func save(data: String) { print(&quot;Saving in MySQL&quot;) }<br>}<br><br>class MongoDBDatabase: Database {<br>    func save(data: String) { print(&quot;Saving in MongoDB&quot;) }<br>}<br><br>class UserService {<br>    private let db: Database<br>    init(db: Database) { self.db = db }<br>    func saveUser(_ user: String) {<br>        db.save(data: user)<br>    }<br>}</pre><p>In this case, you can <strong>inject</strong> any database — MySQL, Mongo, or even a mock for testing — without changing your core logic.</p><h3><strong>Final Thoughts:</strong></h3><p>Writing clean, maintainable code isn’t about fancy patterns — it’s about <strong>thinking long-term</strong>.<br>Start applying <strong>SOLID principles</strong> to your projects, and you’ll immediately see your architecture evolve into something robust, readable, and future-proof.</p><blockquote>“First make it work, then make it right, then make it fast.”<br> — Kent Beck</blockquote><p>✍️ Written by <strong>Soumya Mishra</strong><br>iOS Developer | Swift Enthusiast | Clean Architecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b416db46d43a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Declarative Navigation in Flutter with GoRouter]]></title>
            <link>https://medium.com/@soumyamishra637/mastering-declarative-navigation-in-flutter-with-gorouter-981cf577d348?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/981cf577d348</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 16:49:34 GMT</pubDate>
            <atom:updated>2025-06-24T16:49:34.318Z</atom:updated>
            <content:encoded><![CDATA[<p>Navigating between different screens in Flutter apps — especially when using tab bars, login flows, or deep links — can get complicated. That’s where <strong>GoRouter</strong> comes in. It’s Flutter’s official navigation tool, built on <strong>Navigator 2.0</strong>, and it uses a <strong>declarative, state-based</strong> approach to make things easier.</p><p>In this article, we’ll cover:</p><ul><li>What GoRouter is</li><li>Why it’s better than the traditional Navigator</li><li>Key parts and how it works</li><li>Full examples, including nested navigation</li><li>Real-world use cases and benefits</li></ul><h3>Why GoRouter?</h3><p>Before GoRouter, we had two major navigation systems:</p><ul><li><strong>Navigator 1.0</strong> (Imperative)</li><li><strong>Navigator 2.0</strong> (Declarative, but verbose)</li></ul><p><strong>GoRouter</strong> simplifies Navigator 2.0 into a <strong>declarative, state-driven, testable</strong> system that supports:</p><ul><li>Deep linking</li><li>Nested navigation</li><li>Authentication-based redirection</li><li>Route parameters and named routes</li></ul><h3>Key Components of GoRouter</h3><p>To understand how GoRouter works, let’s break down its core components. These are the building blocks that power navigation in a declarative and scalable way.</p><h4>🔹 GoRouter</h4><blockquote>The core of the navigation setup.<br>It holds the entire route configuration for your app, including initial location, redirect logic, and all defined routes.</blockquote><pre>final router = GoRouter(<br>  initialLocation: &#39;/&#39;,<br>  routes: [...],<br>);</pre><h4>🔹 GoRoute</h4><blockquote>Defines a single route in your app.<br>Each GoRoute includes a path and a builder or pageBuilder to display a screen.</blockquote><pre>GoRoute(<br>  path: &#39;/profile&#39;,<br>  builder: (context, state) =&gt; ProfileScreen(),<br>)</pre><h4>🔹 ShellRoute</h4><blockquote>Enables <strong>nested navigation</strong>, ideal for apps with tab bars, drawers, or nested stacks.<br>It acts like a layout or wrapper that stays persistent while inner routes change.</blockquote><h4>🔹 GoRouter.of(context).go()</h4><blockquote>Used to navigate programmatically.<br>It replaces the current route with a new one (similar to <strong>Navigator.pushReplacement</strong>).</blockquote><pre>GoRouter.of(context).go(&#39;/home&#39;);</pre><p>You can also use the <strong>goNamed()</strong> method for named routes with parameters.</p><h4>🔹 state</h4><blockquote>The <strong>GoRouterState</strong> object provides information about the current route:</blockquote><ul><li>Path parameters</li><li>Query parameters</li><li>Route location</li></ul><pre>final userId = state.pathParameters[&#39;id&#39;];</pre><h4>🔹 redirect</h4><blockquote>Allows dynamic route control — for example, redirecting users to a login screen if they’re not authenticated.</blockquote><pre>redirect: (context, state) {<br>  if (!authService.isLoggedIn) return &#39;/login&#39;;<br>  return null;<br>}</pre><h3>Basic Setup</h3><p><strong>Step 1:</strong> Add GoRouter to <strong>pubspec.yaml</strong></p><pre>dependencies:<br>  go_router: ^15.2.4</pre><p><strong>Step 2:</strong> Define Routes</p><pre>final GoRouter _router = GoRouter(<br>  initialLocation: &#39;/&#39;,<br>  routes: [<br>    GoRoute(<br>      path: &#39;/&#39;,<br>      name: &#39;home&#39;,<br>      builder: (context, state) =&gt; HomeScreen(),<br>    ),<br>    GoRoute(<br>      path: &#39;/profile/:id&#39;,<br>      name: &#39;profile&#39;,<br>      builder: (context, state) {<br>        final userId = state.pathParameters[&#39;id&#39;]!;<br>        return ProfileScreen(userId: userId);<br>      },<br>    ),<br>  ],<br>);</pre><p><strong>Step 3:</strong> Hook into the App</p><pre>MaterialApp.router(<br>  routerConfig: _router,<br>  debugShowCheckedModeBanner: false,<br>)</pre><h4>Navigating Between Screens</h4><p><strong>Simple Navigation</strong></p><pre>GoRouter.of(context).go(&#39;/profile/123&#39;);</pre><p><strong>Named Routes</strong></p><pre>context.goNamed(&#39;profile&#39;, pathParameters: {&#39;id&#39;: &#39;123&#39;});</pre><h3>Nested Navigation with ShellRoute (Tabs)</h3><p>This is perfect for <strong>BottomNavigationBar</strong> apps.</p><pre>final GoRouter _router = GoRouter(<br>  routes: [<br>    ShellRoute(<br>      builder: (context, state, child) =&gt; MainScaffold(child: child),<br>      routes: [<br>        GoRoute(path: &#39;/home&#39;, builder: (context, state) =&gt; HomeScreen()),<br>        GoRoute(path: &#39;/settings&#39;, builder: (context, state) =&gt; SettingsScreen()),<br>      ],<br>    ),<br>  ],<br>);</pre><p><strong>MainScaffold </strong>with BottomNavigationBar ; This is the shared layout used in <strong>ShellRoute</strong>.</p><pre>class MainScaffold extends StatelessWidget {<br>  final Widget child;<br>  const MainScaffold({required this.child});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: child,<br>      bottomNavigationBar: BottomNavigationBar(<br>        currentIndex: _getSelectedIndex(context),<br>        onTap: (index) {<br>          final routes = [&#39;/home&#39;, &#39;/settings&#39;];<br>          context.go(routes[index]);<br>        },<br>        items: const [<br>          BottomNavigationBarItem(icon: Icon(Icons.home), label: &#39;Home&#39;),<br>          BottomNavigationBarItem(icon: Icon(Icons.settings), label: &#39;Settings&#39;),<br>        ],<br>      ),<br>    );<br>  }<br><br>  int _getSelectedIndex(BuildContext context) {<br>    final location = GoRouterState.of(context).uri.toString();<br>    if (location.contains(&#39;/settings&#39;)) return 1;<br>    return 0;<br>  }<br>}</pre><h4><strong>Route </strong>Parameters and<strong> Query </strong>Parameters</h4><p><strong>Path Parameter</strong></p><pre>GoRoute(<br>  path: &#39;/product/:id&#39;,<br>  builder: (context, state) {<br>    final id = state.pathParameters[&#39;id&#39;]!;<br>    return ProductPage(productId: id);<br>  },<br>);</pre><p><strong>Query Parameter</strong></p><pre>context.go(&#39;/search?query=shoes&#39;);<br><br>GoRoute(<br>  path: &#39;/search&#39;,<br>  builder: (context, state) {<br>    final query = state.uri.queryParameters[&#39;query&#39;];<br>    return SearchScreen(query: query);<br>  },<br>);</pre><h4>Testing GoRouter</h4><p>Use the <strong>routerConfig</strong> and test with <strong>pumpWidget.</strong></p><pre>testWidgets(&#39;navigates to profile&#39;, (tester) async {<br>  final router = GoRouter(<br>    routes: [/* Your Routes */],<br>  );<br><br>  await tester.pumpWidget(MaterialApp.router(routerConfig: router));<br>  router.go(&#39;/profile/123&#39;);<br>  await tester.pumpAndSettle();<br><br>  expect(find.text(&#39;User ID: 123&#39;), findsOneWidget);<br>});</pre><h3>Benefits of Using GoRouter</h3><p><strong>GoRouter</strong> makes navigation in Flutter apps easier, cleaner, and more powerful. Here’s why it’s a great choice:</p><ol><li><strong>Easy to Read and Manage: </strong>Routes are defined in one place, making your code organized and easy to understand.</li><li><strong>Works with App State: </strong>It uses a declarative style, so navigation changes automatically based on the app’s state — great for things like login/logout.</li><li><strong>Deep Linking Support: </strong>GoRouter supports URLs and deep links out of the box, which is essential for web apps and sharing links.</li><li><strong>Nested Navigation: </strong>With <strong>ShellRoute</strong>, it’s simple to create tabs or layouts where different screens share a common UI.</li><li><strong>Built-in Redirection:</strong> You can easily redirect users based on conditions (like showing the login screen if they’re not authenticated).</li><li><strong>Improved Testability: </strong>Because everything is centralized and based on state, testing navigation becomes much simpler.</li></ol><h3>Final Thoughts</h3><p>Flutter’s navigation has improved a lot and <strong>GoRouter</strong> stands out as a clear winner for modern app architecture. With its declarative, state-driven approach, it simplifies everything from basic page transitions to complex routing logic involving tabs, authentication, and deep linking.</p><p>Whether you’re building a small side project or a production-grade app, GoRouter helps keep your code clean, organized, and scalable. Its built-in support for nested navigation, route guards, and deep linking makes it a powerful tool in every Flutter developer’s toolkit.</p><p>👉 You can explore more and install the package from the official page here: <a href="https://pub.dev/packages/go_router"><strong>https://pub.dev/packages/go_router</strong></a></p><h3>🙋‍♂️ About the Author</h3><p><strong>Soumya Ranjan Mishra</strong><br>Mobile App Developer | iOS &amp; Flutter | Architecture Evangelist<br>Follow me on <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> | <a href="https://github.com/soumya-mishra-97">GitHub</a></p><p>#Flutter #GoRouter #FlutterDev #MobileDevelopment #AppDevelopment #StateManagement #Navigation #FlutterNavigation #FlutterTips #CrossPlatform #DeclarativeUI #CleanArchitecture #DevCommunity #OpenSource</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=981cf577d348" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns in Swift — Build Smarter, Scalable iOS Apps]]></title>
            <link>https://medium.com/@soumyamishra637/design-patterns-in-swift-build-smarter-scalable-ios-apps-59c727e93b54?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/59c727e93b54</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 08:14:35 GMT</pubDate>
            <atom:updated>2025-06-24T05:43:18.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>Design Patterns in Swift — Build Smarter, Scalable iOS Apps</h3><h3>What Are Design Patterns?</h3><p>Design Patterns are <strong>proven solutions</strong> to common problems in software design. It focuses on <strong>class-level or interaction-level design</strong>.</p><blockquote><strong>Scope</strong>: Code-level, focuses on solving a <strong>specific design problem</strong>.</blockquote><p><strong>Types of Design Patterns in Swift</strong></p><ol><li>Creational Design Patterns:</li><li>Structural Design Patterns:</li><li>Behavioral Design Patterns:</li></ol><h3><strong>Creational Patterns:</strong></h3><blockquote><em>Focus: Object</em><strong><em> creation</em></strong><em> logic.</em></blockquote><h4>1. Singleton Pattern:</h4><blockquote>Ensures only one instance of a class exists and provides a global access point to it.</blockquote><h4><strong>Use Cases:</strong></h4><ul><li><em>Managing a shared resource like a database, network layer.</em></li><li><em>Example: </em><em>UserDefaults, </em><em>URLSession.shared, </em><em>UIApplication.shared.</em></li></ul><pre>class APIClient {<br>    static let shared = APIClient() // Shared static instance of APIClient.<br><br>    private init() {}  // Prevent external initialization<br><br>    func fetchData() {<br>        print(&quot;Fetching data...&quot;)<br>    }<br>}<br><br>APIClient.shared.fetchData()</pre><h4>2. Factory Pattern:</h4><blockquote>Encapsulates object creation logic.</blockquote><h4><strong>Use Cases:</strong></h4><ul><li><em>Dynamic object creation.</em></li><li><em>Dependency injection of concrete types.</em></li></ul><pre>// Define protocol for all vehicle types<br>protocol Vehicle {<br>    func start() <br>}<br><br>// Concrete implementation of Vehicle - Car<br>class Car: Vehicle {<br>    func start() {<br>        print(&quot;Car started&quot;)<br>    }<br>}<br><br>// Another implementation of Vehicle - Bike<br>class Bike: Vehicle {<br>    func start() {<br>        print(&quot;Bike started&quot;)<br>    }<br>}<br><br>// Enum to represent different types of vehicles<br>enum VehicleType {<br>    case car<br>    case bike<br>}<br><br>// Factory class that creates Vehicle instances based on type<br>class VehicleFactory {<br>    // Static method to return a specific Vehicle instance<br>    static func create(type: VehicleType) -&gt; Vehicle {<br>        switch type {<br>        case .car:<br>            return Car() // Return a Car instance<br>        case .bike:<br>            return Bike() // Return a Bike instance<br>        }<br>    }<br>}<br><br>// Create a vehicle instance (Bike / Car)<br>let vehicle = VehicleFactory.create(type: .bike) <br>vehicle.start()</pre><p>Creating views or UI elements dynamically based on user roles.</p><h3>Structural Patterns:</h3><blockquote><em>Focus: </em><strong>Composition and relationships</strong> between classes and objects.</blockquote><h4>1. Adapter Pattern:</h4><blockquote>Bridges Two Incompatible Interfaces. <strong>i.e; </strong>Making two components or classes work together even if they don’t share the same method or protocols.</blockquote><h4><strong>Use Cases:</strong></h4><ul><li><em>Adapter wraps an existing object and Converts its interface into a form the client expects.</em></li><li><em>Allows reuse of incompatible third-party or legacy code without modifying it.</em></li><li><em>Integrating with old code, external SDKs, or third-party libraries.</em></li></ul><pre>// MARK: - Target Protocol<br>/// Defines the expected logging interface used across the app<br>protocol NewLogger {<br>    func log(_ message: String)<br>}<br><br>// MARK: - Adaptee (Legacy System)<br>/// A third-party or legacy logger with a different method signature<br>class LegacyLogger {<br>    func writeLog(_ msg: String) {<br>        print(&quot;Legacy log: \(msg)&quot;)<br>    }<br>}<br><br>// MARK: - Adapter<br>/// Adapter that bridges LegacyLogger to conform to the NewLogger interface<br>class LoggerAdapter: NewLogger {<br>    private let legacyLogger = LegacyLogger()<br><br>    func log(_ message: String) {<br>        // Delegates the call to the legacy logger&#39;s method<br>        legacyLogger.writeLog(message)<br>    }<br>}<br><br>/// Use the adapter wherever `NewLogger` is expected<br>let logger: NewLogger = LoggerAdapter()<br>logger.log(&quot;App started&quot;)</pre><h4>2. Decorator Pattern:</h4><blockquote>Adds responsibilities to objects dynamically. <strong>i.e; </strong>allows behavior to be added to an individual object, dynamically, without modifying its original class.</blockquote><p>It follows the principle:</p><blockquote><strong>Composition over inheritance</strong><br>Wrapping a base object with additional behavior.</blockquote><h4><strong>Use Cases:</strong></h4><ul><li><em>Flexible Extension: Add features (e.g., milk, sugar) without changing existing classes</em></li><li><em>Composability: Combine multiple decorators dynamically</em></li><li><em>Open/Closed Principle: Classes are open for extension but closed for modification.</em></li></ul><pre>// Protocol defining the base component<br>protocol Button {<br>    func draw()<br>}<br><br>// Concrete implementation of the base button<br>class BasicButton: Button {<br>    func draw() {<br>        print(&quot;Drawing a basic button&quot;)<br>    }<br>}<br><br>// Base Decorator class that conforms to Button protocol<br>class ButtonDecorator: Button {<br>    private let decoratedButton: Button<br>    <br>    init(decoratedButton: Button) {<br>        self.decoratedButton = decoratedButton<br>    }<br>    <br>    func draw() {<br>        decoratedButton.draw() <br>    }<br>}<br><br>// Concrete Decorator: adds a border<br>class BorderDecorator: ButtonDecorator {<br>    override func draw() {<br>        super.draw()<br>        addBorder()<br>    }<br>    <br>    private func addBorder() {<br>        print(&quot;Added a border to the button&quot;)<br>    }<br>}<br><br>// Concrete Decorator: adds a shadow<br>class ShadowDecorator: ButtonDecorator {<br>    override func draw() {<br>        super.draw()<br>        addShadow()<br>    }<br>    <br>    private func addShadow() {<br>        print(&quot;Added shadow to the button&quot;)<br>    }<br>}<br><br>let basicButton = BasicButton()<br>let borderedButton = BorderDecorator(decoratedButton: basicButton)<br>let decoratedButton = ShadowDecorator(decoratedButton: borderedButton)<br>decoratedButton.draw()</pre><h3>Behavioral Patterns:</h3><blockquote><em>Focus: </em><strong>Communication</strong> between objects.</blockquote><h4>1. Observer Pattern:</h4><blockquote>Notifies objects / subscribers when state changes (like Combine or NotificationCenter). <strong>i.e; </strong>allows an object (called the <strong>subject</strong> or <strong>publisher</strong>) to notify <strong>subscribers (observers)</strong> about changes in its state.</blockquote><h4><strong>Use Cases:</strong></h4><p><strong>a. Observer Pattern Using </strong><strong>NotificationCenter</strong></p><blockquote>Notify a UI component when user login state changes.</blockquote><pre>import Foundation<br><br>// Define a notification name<br>extension Notification.Name {<br>    static let userDidLogin = Notification.Name(&quot;userDidLogin&quot;)<br>}<br><br>// Publisher (Observable)<br>class UserManager {<br>    func loginUser() {<br>        print(&quot;User logged in successfully.&quot;)<br>        <br>        // Notify all observers that user has logged in<br>        NotificationCenter.default.post(name: .userDidLogin, object: nil)<br>    }<br>}<br><br>// Observer<br>class DashboardView {<br>    init() {<br>        // Add observer for login notification<br>        NotificationCenter.default.addObserver(self,<br>                                               selector: #selector(handleLogin),<br>                                               name: .userDidLogin,<br>                                               object: nil)<br>    }<br><br>    @objc func handleLogin() {<br>        print(&quot;DashboardView: User logged in, show welcome screen.&quot;)<br>    }<br><br>    deinit {<br>        NotificationCenter.default.removeObserver(self)<br>    }<br>}<br><br>let userManager = UserManager()<br>let dashboard = DashboardView()<br><br>userManager.loginUser()<br><br>// Output:<br>// User logged in successfully.<br>// DashboardView: User logged in, show welcome screen.</pre><p><strong>b. Observer Pattern Using </strong><strong>Combine</strong></p><blockquote>UI observes changes in user name property.</blockquote><pre>import Combine<br><br>// Observable class (Publisher)<br>class User: ObservableObject {<br>    // Published property: observers get notified when it changes<br>    @Published var name: String = &quot;&quot;<br>}<br><br>// Observer class<br>class ProfileView {<br>    private var cancellable: AnyCancellable?<br><br>    init(user: User) {<br>        // Subscribe to changes in the user&#39;s name<br>        cancellable = user.$name.sink { newName in<br>            print(&quot;ProfileView: User name updated to \(newName)&quot;)<br>        }<br>    }<br>}<br><br>let user = User()<br>let profileView = ProfileView(user: user)<br><br>user.name = &quot;Soumya&quot;<br><br>// Output:<br>// ProfileView: User name updated to Soumya</pre><h4>2. Strategy Pattern:</h4><blockquote>Encapsulates interchangeable algorithms. <strong>i.e; </strong>define a family of algorithms, put each one in a separate class, and make their objects interchangeable <strong>at runtime</strong>.</blockquote><h4>Use Cases:</h4><ul><li><em>Open/Closed Principle: Add new strategies without changing existing code.</em></li><li><em>Flexible Runtime: Swap algorithms dynamically based on user input.</em></li></ul><p><strong>Payment Gateway Selection (e.g., CreditCard, UPI, Wallet)</strong></p><h4><strong>Goal</strong>:</h4><p>Client code like CheckoutScreen should <strong>not depend on specific payment classes</strong>. It should work with <strong>any payment strategy</strong> dynamically.</p><pre>// MARK: - Strategy Protocol<br>/// The `PaymentStrategy` protocol defines all payment methods.<br>protocol PaymentStrategy {<br>    /// Executes the payment logic with the given amount.<br>    func pay(amount: Double)<br>}<br><br>// MARK: - Concrete Strategy: Credit Card<br>/// A concrete implementation of `PaymentStrategy` for credit card payments.<br>class CreditCardPayment: PaymentStrategy {<br>    func pay(amount: Double) {<br>        print(&quot;Paid ₹\(amount) with Credit Card&quot;)<br>    }<br>}<br><br>// MARK: - Concrete Strategy: UPI<br>/// A concrete implementation of `PaymentStrategy` for UPI payments.<br>class UpiPayment: PaymentStrategy {<br>    func pay(amount: Double) {<br>        print(&quot;Paid ₹\(amount) with UPI&quot;)<br>    }<br>}<br><br>// MARK: - Concrete Strategy: Wallet<br>/// A concrete implementation of `PaymentStrategy` for wallet payments.<br>class WalletPayment: PaymentStrategy {<br>    func pay(amount: Double) {<br>        print(&quot;Paid ₹\(amount) with Wallet&quot;)<br>    }<br>}<br><br>// MARK: - Payment Processor<br>class PaymentProcessor {<br>    /// Holds the current payment strategy.<br>    private var strategy: PaymentStrategy<br><br>    /// Initializes the processor with a specific payment strategy.<br>    init(strategy: PaymentStrategy) {<br>        self.strategy = strategy<br>    }<br><br>    /// Allows changing the strategy at runtime <br>    /// (e.g., when user selects a different payment method).<br>    func updateStrategy(_ strategy: PaymentStrategy) {<br>        self.strategy = strategy<br>    }<br><br>    /// Executes the payment using the current strategy.<br>    func process(amount: Double) {<br>        strategy.pay(amount: amount)<br>    }<br>}<br><br>let processor = PaymentProcessor(strategy: CreditCardPayment())<br>processor.process(amount: 199.0)<br><br>processor.updateStrategy(UpiPayment())<br>processor.process(amount: 299.0)<br><br>/// Output:<br>/// Paid ₹199.0 with Credit Card<br>/// Paid ₹299.0 with UPI</pre><h3>Final Thoughts</h3><p>Design Patterns are not just reusable code. They are tried-and-tested solutions to common problems that help you write clean, organized, and easy-to-maintain software.</p><p><strong>Use design patterns to:</strong></p><ul><li>Save time by reusing proven solutions</li><li>Write flexible and reusable code</li><li>Keep code organized and well-separated</li><li>Make your code easier to test and understand</li><li>Help your team quickly grasp your code’s purpose</li></ul><p><strong>💡 Mastering design patterns in Swift helps you write clean, modular code and build apps that are easy to scale and maintain.</strong></p><blockquote>Design patterns are the language of software architecture. The more fluent you become, the more expressive, adaptable, and robust your solutions will be.</blockquote><h3>🙋‍♂️ About the Author</h3><p><strong>Soumya Ranjan Mishra</strong><br>Mobile App Developer | iOS &amp; Flutter | Architecture Evangelist<br>Follow me on <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> | <a href="https://github.com/soumya-mishra-97">GitHub</a></p><p>#iOSDevelopment #SwiftLang #DesignPatterns #CleanArchitecture #MVVM #SwiftUI #Xcode #SoftwareArchitecture #CodeQuality #MaintainableCode #MobileEngineering #SOLIDPrinciples #iOSDev #Refactoring #AppleDeveloper #OOP #iOSCommunity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59c727e93b54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Loading User Data in SwiftUI with MVVM and Combine: From API and Local JSON]]></title>
            <link>https://medium.com/@soumyamishra637/loading-user-data-in-swiftui-with-mvvm-and-combine-from-api-and-local-json-65ea46ba95f3?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/65ea46ba95f3</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Sat, 24 May 2025 08:01:28 GMT</pubDate>
            <atom:updated>2025-05-24T08:01:28.378Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we’ll explore how to fetch and display user data in SwiftUI using the MVVM architecture. We’ll load data from two sources:</p><ol><li>A remote API using URLSession and Combine</li><li>A local users.json file bundled with the app</li></ol><h3>Why MVVM?</h3><p>MVVM (Model–View–ViewModel) helps us separate concerns:</p><blockquote><strong>Model</strong>: The data structure (e.g. User)</blockquote><blockquote><strong>View</strong>: What the user sees (e.g. a list of users)</blockquote><blockquote><strong>ViewModel</strong>: The business logic that transforms and supplies data to the view</blockquote><h3>Step 1: Define Your Models</h3><pre>// MARK: - User Model<br>struct User: Decodable, Identifiable {<br>    let id: Int<br>    let name, username, email: String<br>    let address: Address<br>    let phone, website: String<br>    let company: Company<br>}<br><br>// MARK: - Address<br>struct Address: Codable {<br>    let street, suite, city, zipcode: String<br>    let geo: Geo<br>}<br><br>// MARK: - Geo<br>struct Geo: Codable {<br>    let lat, lng: String<br>}<br><br>// MARK: - Company<br>struct Company: Codable {<br>    let name, catchPhrase, bs: String<br>}</pre><blockquote>The Identifiable protocol allows SwiftUI to uniquely identify each user in a list.</blockquote><h3>Step 2: Create the ViewModel</h3><pre>import Foundation<br>import Combine<br><br>class UserServicesViewModel: ObservableObject {<br>    <br>    @Published var users: [User] = []<br>    private var cancellables: Set&lt;AnyCancellable&gt; = []<br>    <br>    init () {<br>        fetchUsersFromLocal()<br>    }<br>    <br>    // MARK: - Load from API<br>    func fetchUsersFromAPI() {<br>        guard let url = URL(string: &quot;https://jsonplaceholder.typicode.com/users&quot;) else{<br>            return<br>        }<br>        <br>        URLSession.shared.dataTaskPublisher(for: url)<br>            .map(\.data)<br>            .decode(type: [User].self, decoder: JSONDecoder())<br>            .receive(on: DispatchQueue.main)<br>            .sink(receiveCompletion: { completion in<br>                if case let .failure(error) = completion {<br>                    print(&quot;Api Error: \(error)&quot;)<br>                }<br>            },<br>                  receiveValue: {[weak self] users in<br>                self?.users = users<br>            }).store(in: &amp;cancellables)<br>        <br>    }<br>    <br>    // MARK: - Load from Local JSON<br>    func fetchUsersFromLocal() {<br>        guard let url = Bundle.main.url(/service/forresource: &quot;users&quot;, withExtension: &quot;json&quot;) else {<br>            print(&quot;Local JSON file not found&quot;)<br>            return<br>        }<br>        <br>        do {<br>            let data = try Data(contentsOf: url)<br>            let decodedUsers = try JSONDecoder().decode([User].self, from: data)<br>            self.users = decodedUsers<br>        } catch {<br>            print(&quot;Local JSON decode error: \(error)&quot;)<br>        }<br>    }<br>}</pre><blockquote>@Published triggers view updates, while Combine handles asynchronous data flow from the network.</blockquote><h3>Step 3: Build the SwiftUI View</h3><pre>import SwiftUI<br><br>struct UserView: View {<br>    @StateObject private var viewModel = UserServicesViewModel()<br>    <br>    var body: some View {<br>        List(viewModel.users) { user in<br>            VStack(alignment: .leading) {<br>                Text(user.name).font(.headline)<br>                Text(user.email).foregroundColor(.secondary)<br>                Text(&quot;City: \(user.address.city), Zip: \(user.address.zipcode)&quot;)<br>                    .font(.subheadline)<br>                Text(&quot;Company: \(user.company.name)&quot;)<br>                    .font(.subheadline).italic()<br>            }<br>        }<br>    }<br>}<br><br>#Preview {<br>    UserView()<br>}</pre><blockquote>This view observes changes in UserViewModel and automatically updates when users changes.</blockquote><h3>Step 4: Sample ``users.json``</h3><p>Place this file in your Xcode project and ensure it’s included in the target:</p><pre>[<br>  {<br>    &quot;id&quot;: 1,<br>    &quot;name&quot;: &quot;Leanne Graham&quot;,<br>    &quot;username&quot;: &quot;Bret&quot;,<br>    &quot;email&quot;: &quot;Sincere@april.biz&quot;,<br>    &quot;address&quot;: {<br>      &quot;street&quot;: &quot;Kulas Light&quot;,<br>      &quot;suite&quot;: &quot;Apt. 556&quot;,<br>      &quot;city&quot;: &quot;Gwenborough&quot;,<br>      &quot;zipcode&quot;: &quot;92998-3874&quot;,<br>      &quot;geo&quot;: {<br>        &quot;lat&quot;: &quot;-37.3159&quot;,<br>        &quot;lng&quot;: &quot;81.1496&quot;<br>      }<br>    },<br>    &quot;phone&quot;: &quot;1-770-736-8031 x56442&quot;,<br>    &quot;website&quot;: &quot;hildegard.org&quot;,<br>    &quot;company&quot;: {<br>      &quot;name&quot;: &quot;Romaguera-Crona&quot;,<br>      &quot;catchPhrase&quot;: &quot;Multi-layered client-server neural-net&quot;,<br>      &quot;bs&quot;: &quot;harness real-time e-markets&quot;<br>    }<br>  },<br>  {<br>    &quot;id&quot;: 2,<br>    &quot;name&quot;: &quot;Ervin Howell&quot;,<br>    &quot;username&quot;: &quot;Antonette&quot;,<br>    &quot;email&quot;: &quot;Shanna@melissa.tv&quot;,<br>    &quot;address&quot;: {<br>      &quot;street&quot;: &quot;Victor Plains&quot;,<br>      &quot;suite&quot;: &quot;Suite 879&quot;,<br>      &quot;city&quot;: &quot;Wisokyburgh&quot;,<br>      &quot;zipcode&quot;: &quot;90566-7771&quot;,<br>      &quot;geo&quot;: {<br>        &quot;lat&quot;: &quot;-43.9509&quot;,<br>        &quot;lng&quot;: &quot;-34.4618&quot;<br>      }<br>    },<br>    &quot;phone&quot;: &quot;010-692-6593 x09125&quot;,<br>    &quot;website&quot;: &quot;anastasia.net&quot;,<br>    &quot;company&quot;: {<br>      &quot;name&quot;: &quot;Deckow-Crist&quot;,<br>      &quot;catchPhrase&quot;: &quot;Proactive didactic contingency&quot;,<br>      &quot;bs&quot;: &quot;synergize scalable supply-chains&quot;<br>    }<br>  }<br>]</pre><h3>Final Output:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0x1kwLmH8GlYJPCSF3aTw.png" /></figure><blockquote>Each user displays: Name, Email, City &amp; Zip Code, Company Name</blockquote><h3>Summary Overview</h3><ul><li><em>How to fetch data using </em><em>URLSession and </em><em>Combine</em></li><li><em>How to decode JSON into </em><em>Codable models</em></li><li><em>How to structure an app using </em><em>MVVM</em></li><li><em>How to bind a view model to a SwiftUI view</em></li></ul><h3>Let’s Connect</h3><p>If this guide helped you, follow me on <a href="https://github.com/soumya-mishra-97">GitHub</a> and <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> for more mobile development tips!</p><p>Thanks.</p><p>#iOSDevelopment #Swift #SwiftTips #SOLID #ApiIntegration #Combine #MVVM #URLSession #Codable #SwiftUI #CleanCode #DesignPatterns #DependencyInjection #SoftwareArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65ea46ba95f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tight vs Loose Coupling in Swift]]></title>
            <link>https://medium.com/@soumyamishra637/tight-vs-loose-coupling-in-swift-33ce33bef874?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/33ce33bef874</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Thu, 01 May 2025 07:05:56 GMT</pubDate>
            <atom:updated>2025-05-01T07:05:56.045Z</atom:updated>
            <content:encoded><![CDATA[<h3>👋 Introduction</h3><p>When building scalable, testable, and maintainable iOS applications, understanding <strong>tight coupling vs loose coupling</strong> is critical.</p><p>Let’s explore both with a relatable analogy: a <strong>Car and its Engine</strong>.</p><h4>What is Tight Coupling?</h4><p>When two classes (or components) depend heavily on each other — changing one will likely break the other.</p><p><strong>Example</strong>: Tightly Coupled Car and Engine</p><p><strong>Tight Coupling:</strong><br>Car → Engine (Concrete)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIhhbJHQgxBY_h152GIgtA.png" /></figure><p><strong>What’s wrong?</strong></p><ul><li>Car is <strong>directly</strong> dependent on <strong>Engine</strong>.</li><li>Cannot use GasEngine, ElectricEngine, or MockEngine without changing Car’s internal logic.</li><li>Not testable or extendable without modifying existing code.</li></ul><p><strong>🚫 Violates SOLID principles:</strong></p><ul><li>❌ Open/Closed Principle (OCP): Car is not open for extension without modification.</li><li>❌ Dependency Inversion Principle (DIP): Car depends on a concrete class, not an abstraction.</li></ul><h4>What is Loose Coupling?</h4><p>Classes depend on abstractions (protocols) instead of concrete implementations — reducing impact when one changes.</p><p><strong>Example</strong>: Loosely Coupled Car and Engine</p><p><strong>Loose Coupling:</strong><br>Car → Engine (Abstract) ← GasEngine / ElectricEngine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnGA04xnle8gKdR3dDAkhA.png" /></figure><p><strong>Loose Coupled:</strong></p><ul><li>Car is <strong>not</strong> directly dependent on any specific engine type — it relies on the <strong>Engine protocol</strong>.</li><li>You can easily switch to GasEngine, ElectricEngine, MockEngine, etc., without changing the Car class.</li><li><strong>Reusability</strong>: Car works with any engine that conforms to Engine, making it easily extensible.</li></ul><p>✅ <strong>Follows SOLID principles</strong>:</p><ul><li>✅ <strong>Open/Closed Principle (OCP)</strong>: Add new engine types without modifying Car.</li><li>✅ <strong>Dependency Inversion Principle (DIP)</strong>: Car depends on an <strong>abstraction</strong>, not a concrete class.</li></ul><h3>Let’s Connect</h3><p>If this guide helped you, follow me on <a href="https://github.com/soumya-mishra-97">GitHub</a> and <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> for more mobile development tips!</p><p>Thanks.</p><p>#iOSDevelopment #Swift #SwiftTips #SOLID #CleanCode #DesignPatterns #DependencyInjection #SoftwareArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33ce33bef874" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Complete Guide to iOS Deployment Certificates: Code Signing, Provisioning, and Publishing…]]></title>
            <link>https://medium.com/@soumyamishra637/a-complete-guide-to-ios-deployment-certificates-code-signing-provisioning-and-publishing-e6e1c8fcb86b?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6e1c8fcb86b</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Thu, 24 Apr 2025 11:49:02 GMT</pubDate>
            <atom:updated>2025-05-01T07:03:50.503Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Complete Guide to iOS Deployment Certificates: Code Signing, Provisioning, and Publishing Explained</h3><p><strong>By Soumya Mishra</strong> | <em>iOS &amp; Flutter Developer | Tech Enthusiast</em></p><p>If you’ve ever tried to publish an iOS app, you’ve likely run into things like certificates, provisioning profiles, and code signing. It might seem confusing at first, but understanding these is key to building and launching your app successfully.</p><p>In this blog post, we’ll break down:</p><ul><li>What certificates are used in iOS deployment</li><li>Why Apple requires them</li><li>How to generate and manage them</li><li>A visual flow diagram that ties it all together</li></ul><h3>What Are iOS Certificates?</h3><p>iOS certificates are <strong>digital credentials</strong> issued by Apple to authenticate your identity and sign your app securely. Think of them as a passport for your app — without one, your app can’t get past Apple’s security checks.</p><h3>Types of Certificates:</h3><ol><li><strong>Development Certificate:</strong> Used to run and debug apps on real devices during development.</li><li><strong>Distribution Certificate:</strong> Used to sign apps for <strong>App Store</strong>, <strong>Ad Hoc</strong>, or <strong>Enterprise</strong> distribution.</li></ol><h4><strong>Why Are Certificates Needed?</strong></h4><p>Apple uses certificates to keep apps safe and under control. They make sure:</p><p>✅ Only trusted developers can put apps on devices<br>✅ Apps are from a reliable source<br>✅ The app hasn’t been changed or hacked<br>✅ Apps only run on approved devices</p><p>It’s all about protecting users and keeping the system secure.</p><h4><strong>How Are Certificates Generated?</strong></h4><p>Here’s a simple 3-step process to create iOS certificates:</p><p><strong>Step 1: Create a Certificate Request (CSR)</strong></p><ul><li>Open <strong>Keychain Access</strong> on your Mac</li><li>Go to <strong>Certificate Assistant &gt; Request a Certificate from a Certificate Authority</strong></li><li>Enter your name and email, choose “<strong>Saved to disk</strong>,” and save the file.</li></ul><p><strong>Step 2: Generate Certificate on Apple Developer Site</strong></p><ul><li>Log in to the <strong><em>Apple Developer Portal</em></strong></li><li>Select <strong>Development</strong> or <strong>Distribution</strong> certificate</li><li>Upload the .certSigningRequest file</li><li>Download the generated .cer file</li></ul><p><strong>Step 3: Install the Certificate</strong></p><ul><li>Double-click the .cer file to install it in <strong>Keychain Access</strong></li></ul><h4><strong>Provisioning Profiles: The Key to Connecting Certificates, App IDs, and Devices</strong></h4><p>After creating your certificates, you need a <strong>Provisioning Profile</strong> to connect:</p><p>✅ Your Certificate<br>✅ App ID (Bundle Identifier)<br>✅ Devices (for testing)<br>✅ Distribution method</p><p>There are different types of profiles:</p><ul><li><strong>Development Profile</strong></li><li><strong>Ad Hoc Profile</strong></li><li><strong>App Store Profile</strong></li><li><strong>Enterprise Profile</strong></li></ul><p>You can create Provisioning Profiles in the <strong><em>Apple Developer Portal &gt; Profiles</em></strong><em>.</em></p><h4>iOS Deployment Certificate Flow (Diagram)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4IzIwboYUrq_Gee3R0QPA.png" /></figure><h4>Summary Flow Logic</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcMGhNjjNg4caemd-MeqHg.png" /></figure><h4><strong>Tips</strong></h4><ul><li>✅ Use <strong>Automatic Signing</strong> in Xcode if you’re a solo dev</li><li>✅ Use <strong>Manual Signing</strong> for CI/CD pipelines (e.g., Fastlane)</li><li>✅ Keep your certificates backed up (especially for teams)</li><li>✅ Renew certificates before expiry to avoid build issues</li></ul><h4>Final Thoughts</h4><p>Setting up certificates may be <strong>tricky at first</strong>, but once done, they ensure the <strong>security and quality</strong> of your iOS app. Mastering this process is an <strong>important skill</strong> for iOS developers, helping you fix code-signing issues and set up automated pipelines like <strong>Fastlane, or GitHub Actions</strong> more easily.</p><h3>Let’s Connect</h3><p>If this guide helped you, follow me on <a href="https://github.com/soumya-mishra-97">GitHub</a> and <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> for more mobile development tips!</p><p>Thanks.</p><p>#iOSDevelopment #Swift #SwiftTips #SOLID #CleanCode #DesignPatterns #DependencyInjection #SoftwareArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6e1c8fcb86b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inside the Flutter Rendering Engine: The Layout & Rendering Pipeline]]></title>
            <link>https://medium.com/@soumyamishra637/inside-the-flutter-rendering-engine-the-layout-rendering-pipeline-48cff08fb92c?source=rss-3c7ee4415058------2</link>
            <guid isPermaLink="false">https://medium.com/p/48cff08fb92c</guid>
            <dc:creator><![CDATA[Soumya Ranjan Mishra]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 07:13:59 GMT</pubDate>
            <atom:updated>2025-05-01T07:05:19.350Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Flutter</strong> is known for its fast rendering and smooth UI across platforms. But what’s the secret sauce behind this magic? It all comes down to Flutter’s <strong>Rendering Engine</strong> and its well-structured layout pipeline.</p><p>In this article, we’ll break down:</p><ul><li>Flutter’s <strong>Rendering Engine architecture</strong></li><li>The <strong>layout structure</strong>: top, medium, and bottom layers</li><li>How Flutter transforms <strong>Widget Tree → Element Tree → Render Tree</strong></li><li>The <strong>rasterization</strong> process</li></ul><p>we’ll explore the entire rendering pipeline — from your Widget code to the final pixels on the screen.</p><h4><strong>Overview</strong></h4><p>The rendering flow in Flutter involves two main parts:</p><ol><li><strong>Flutter Framework (Dart)</strong> — Defines UI with widgets.</li><li><strong>Flutter Engine (C++/Skia)</strong> — Converts Flutter’s layout and paint instructions into real pixels.</li></ol><p>This process revolves around <strong>three core trees</strong>:</p><ol><li><strong>Widget Tree</strong> — Declarative UI structure (your code).</li><li><strong>Element Tree</strong> — Stateful representation and lifecycle manager.</li><li><strong>Render Tree</strong> — Layout and paint logic.</li></ol><h4><strong>The Flutter Rendering </strong>Architecture<strong>: Top → Middle → Bottom</strong></h4><p>Flutter’s layout/rendering engine is conceptually divided into three layers:</p><p><strong>1. Top Layer — Framework / Widgets</strong></p><ul><li>Defines the <strong>UI structure and state</strong>.</li><li>Known as the <strong>blueprint</strong> of your UI.</li><li>Contains all your Flutter widgets like Text, Container, Column, etc.</li><li>Declared in the build() method.</li><li>Widgets are <strong>immutable</strong> and are rebuilt frequently.</li></ul><p>🔍 <em>This layer is purely declarative — it describes </em><strong><em>what</em></strong><em> the UI should look like.</em></p><p><strong>2. Middle Layer — Engine / Elements</strong></p><ul><li>The <strong>Element Tree</strong> is built here, connecting widgets to render objects.</li><li>Manages the <strong>widget lifecycle</strong>: mounting, updating, unmounting.</li><li>Performs <strong>widget diffing</strong>: compares old vs new widget trees to determine changes.</li><li>Acts as the <strong>engine room</strong> where widgets become stateful and dynamic.</li><li><strong>Does not directly execute Skia</strong>, but prepares layout and paint instructions for the rendering layer.</li></ul><p>🔍 <em>This is where Flutter manages updates and creates the link between your UI definition and the rendering process.</em></p><p><strong>3. Bottom Layer — Rendering / Render Objects (and Embedded Skia)</strong></p><ul><li>This is where widgets become <strong>visible pixels</strong>.</li><li>Render Objects:</li><li>Handle <strong>layout</strong>, <strong>positioning</strong>, and <strong>painting</strong>.</li><li>Form the <strong>Render Tree</strong>.</li><li>Communicates directly with <strong>Skia</strong>, the rendering engine.</li><li>Skia <strong>rasterizes</strong> the render tree into <strong>GPU-accelerated pixels</strong> on screen.</li></ul><p>🔍 <em>This layer is responsible for the actual drawing and pixel manipulation.</em></p><p><strong>Summary Diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWLIG9T37PYLHfz8M-SVXg.png" /></figure><h4>Inside Flutter’s Rendering Pipeline</h4><p><strong>1. Widget Tree (Top Layer — Framework)</strong></p><ul><li><strong>Describes the UI structure and state</strong>.</li><li>Immutable, rebuilt often in build() methods.</li><li>Examples: Text, Container, Column, etc.</li><li>Does <strong>not</strong> hold any state or layout info.</li></ul><p>Think of it as the <strong><em>UI blueprint</em></strong>.</p><p><strong>2. Element Tree (Middle Layer — Framework)</strong></p><ul><li><strong>Tracks active widget instances</strong>.</li><li>Manages <strong>widget lifecycle</strong> (mounting, updating, unmounting).</li><li><strong>Compares old and new widgets</strong> to determine what needs to be rebuilt.</li><li>Maintains the <strong>link between widgets and render objects</strong>.</li></ul><p>Think of it as the <strong><em>engine room</em></strong> that keeps the <strong>UI alive</strong> and <strong>in sync</strong>.</p><p><strong>3. Render Tree (Bottom Layer — Rendering Layer)</strong></p><ul><li>Composed of <strong>RenderObjects</strong>.</li><li>Handles <strong>layout (position, size)</strong> and <strong>painting</strong> (visual representation).</li><li>Translates <strong>visual instructions</strong> into something <strong>Skia</strong> can draw.</li></ul><p>This is where <strong>widgets become visual elements</strong>.</p><p><strong>4. Rasterization (Engine Layer — Skia &amp; GPU)</strong></p><ul><li>The <strong>Flutter Engine (C++)</strong> takes the <strong>painted render tree</strong>.</li><li>Uses <strong>Skia</strong> (a 2D graphics engine) to <strong>rasterize</strong> it.</li><li>Sends the rasterized frame to the <strong>GPU for display</strong>.</li></ul><p>This is where <strong>render objects become pixels on screen</strong>.</p><p><strong>Summary Diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hTo2mv6pS7-F87mIgYKzA.png" /></figure><p>If you enjoyed this breakdown, hit the 💚 or drop a follow for more in-depth Flutter articles!</p><h3>Let’s Connect</h3><p>If this guide helped you, follow me on <a href="https://github.com/soumya-mishra-97">GitHub</a> and <a href="https://www.linkedin.com/in/soumya-mishra-49440917b/">LinkedIn</a> for more mobile development tips!</p><p>Thanks.</p><p>#FlutterDevelopment #Dart #FlutterTips #SOLID #CleanCode #DesignPatterns #SoftwareArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48cff08fb92c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>