<?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 Vikas Pandey on Medium]]></title>
        <description><![CDATA[Stories by Vikas Pandey on Medium]]></description>
        <link>https://medium.com/@vipandey54?source=rss-a592d40c9800------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*sqRvCS177Eiv0rO3T-L3wA.png</url>
            <title>Stories by Vikas Pandey on Medium</title>
            <link>https://medium.com/@vipandey54?source=rss-a592d40c9800------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 27 May 2026 08:26:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vipandey54/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[From UIKit to SwiftUI: The Easiest Mental Model for iOS Developers]]></title>
            <link>https://medium.com/@vipandey54/from-uikit-to-swiftui-the-easiest-mental-model-for-ios-developers-f711effc5f19?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/f711effc5f19</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Tue, 19 May 2026 14:06:56 GMT</pubDate>
            <atom:updated>2026-05-19T14:06:56.684Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve spent years building iOS apps using Storyboards and UIKit, learning SwiftUI can initially feel confusing.</p><p>Not because SwiftUI is difficult.</p><p>But because it asks you to think differently.</p><p>When most UIKit developers start SwiftUI, they often try to translate UIKit concepts directly:</p><ul><li>“Where is viewDidLoad()?”</li><li>- “How do I update this label manually?”</li><li>- “Where are the constraints?”</li><li>- “Why does the UI refresh automatically?”</li></ul><p>The truth is:</p><p>&gt; SwiftUI is not a newer version of UIKit.</p><p>&gt; It’s a completely different UI philosophy.</p><p>Once you understand the mental model behind SwiftUI, everything starts making sense.</p><p>This article will help you understand SwiftUI in the simplest way possible – especially if you already know UIKit.</p><p># UIKit vs SwiftUI: The Biggest Difference</p><p>In UIKit, we build and update UI manually.</p><p>For example:</p><pre>nameLabel.text = user.name <br>if user.isPremium { <br>badgeView.isHidden = false <br>} </pre><p>You create, manage and update the UI.</p><p>This is called an imperative approach.</p><p>You tell the app:</p><p>“Do this, then update this, then refresh this.”</p><p><strong>SwiftUI works differently.</strong></p><p>Instead of manually updating UI, you simply describe what the UI should look like for a given state.</p><pre>struct ProfileView: View { <br>let user: User <br>var body: some View { <br>VStack { <br>Text(user.name) <br>if user.isPremium { <br>PremiumBadge() <br>} <br>} <br>} <br>} </pre><p>No manual refresh.</p><p>No updating labels.</p><p>No hiding views manually.</p><p>You only describe the UI.</p><p>SwiftUI handles the rendering automatically.</p><p><strong>This is called a declarative approach.</strong></p><p># The One Formula That Explains SwiftUI</p><p>If you remember only one thing from this article, remember this:</p><p><strong>## UI = f(State)</strong></p><p>Meaning:</p><p>SwiftUI = function(currentData)</p><p>Whenever your data changes, SwiftUI automatically redraws the UI.</p><p><strong>That’s the heart of SwiftUI.</strong></p><p>– -</p><p># Stop Thinking About Views. Start Thinking About State.</p><p>UIKit developers are trained to think like this:</p><pre>text Create View ↓ Update View ↓ Reload View ↓ Fix Constraints ↓ Manage Lifecycle </pre><p>SwiftUI changes this completely.</p><p>Now the thinking becomes:</p><p><strong>text DATA ↓ STATE ↓ UI DESCRIPTION ↓ AUTOMATIC UI UPDATE</strong></p><p>This mindset shift is the key to mastering SwiftUI.</p><p>– -</p><p># The 5 Core Building Blocks of SwiftUI</p><p>The good news?</p><p>Almost every SwiftUI screen is built using just a few concepts.</p><p>Master these, and you can build almost anything.</p><p>– -</p><p># 1. Everything is a View</p><p>In UIKit, you had:</p><ul><li>UILabel</li><li>UIButton</li><li>UIImageView</li><li>UIView</li></ul><p>In SwiftUI:</p><p>swift Text(“Hello”) Button(“Save”) { } Image(systemName: “star”)</p><p>Everything conforms to View.</p><p>Even entire screens are just views.</p><p>– -</p><p># 2. Layouts are Built Using Stacks</p><p>Instead of AutoLayout constraints, SwiftUI uses composition.</p><p>## Vertical Layout</p><pre>VStack { Text(“Name”) Text(“Email”) } </pre><p>## Horizontal Layout</p><pre>HStack { Image(systemName: “person”) Text(“Profile”) } </pre><p>## Layered Layout</p><pre>ZStack { Color.blue. Text(“Overlay”) } </pre><p>– -</p><p><strong># Think of SwiftUI Like LEGO Blocks</strong></p><p>This is one of the easiest ways to understand layouts.</p><p>In UIKit:</p><ul><li>constraints</li><li>anchors</li><li>priorities</li><li>constant adjustments</li></ul><p>In SwiftUI:</p><ul><li>nest views</li><li>apply spacing</li><li>add padding</li><li>compose layouts naturally</li></ul><p>You build interfaces by combining containers together.</p><p>– -</p><p># 3. Modifiers Control Styling</p><p>In UIKit:</p><pre>label.textColor = .red <br>label.font = .boldSystemFont(ofSize: 20) </pre><p>In SwiftUI:</p><pre>Text(“Hello”) <br>.foregroundColor(.red) <br>.font(.title) </pre><p>SwiftUI relies heavily on modifier chaining.</p><p>This pattern applies everywhere:</p><ul><li>padding</li><li>colors</li><li>animations</li><li>gestures</li><li>shadows</li><li>navigation</li></ul><p>The universal syntax becomes:</p><pre>View() <br>.modifier1() <br>.modifier2() <br>.modifier3() </pre><p>– -</p><p><strong># 4. State is the Source of Truth</strong></p><p>This is the most important SwiftUI concept.</p><p>UIKit developers usually ask:</p><p>&gt; “How do I refresh the UI?”</p><p>SwiftUI developers ask:</p><p><strong>&gt; “What state should the UI represent?”</strong></p><p>Example:</p><pre>struct CounterView: View { <br>@State private var count = 0<br>var body: some View { <br>VStack { <br>Text(“\(count)”) <br>Button(“Increase”) { <br>count += 1<br>} } } } </pre><p>When count changes: – UI refreshes automatically</p><p>No:</p><ul><li>reloadData()</li><li>setNeedsLayout()</li><li>manual updates</li></ul><p>This is the real SwiftUI magic.</p><p>– -</p><p># 5. SwiftUI Loves Reusable Components</p><p>In UIKit:</p><ul><li>custom UIView</li><li>XIB reuse</li><li>delegate wiring</li></ul><p>In SwiftUI:</p><pre>struct ProfileRow: View { <br>let title: String<br>var body: some View { <br>HStack { <br>Image(systemName: “person”) <br>Text(title) <br>} } } </pre><p>Usage:</p><pre>ProfileRow(title: “Vikas”) <br>ProfileRow(title: “Nitesh”) <br>ProfileRow(title: “Vivek”) </pre><p>Small reusable components are the foundation of scalable SwiftUI architecture.</p><p>– -</p><p><strong># UIKit to SwiftUI Mapping Cheat Sheet</strong></p><p>One of the fastest ways to learn SwiftUI is to map familiar UIKit concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*BrowDNPLmWKB1FN8MGSVSg@2x.jpeg" /></figure><p>This comparison alone accelerates learning dramatically.</p><p>– -</p><p># The Best Way to Learn SwiftUI</p><p>Many developers make the mistake of starting with:</p><ul><li>architecture</li><li>Combine</li><li>MVVM</li><li>advanced state management</li></ul><p>Don’t start there.</p><p>The easiest learning path is:</p><p>## Rebuild Your Existing UIKit Screens</p><p>This technique works incredibly well because:</p><ul><li>you already know the business logic</li><li>you already know the layout</li><li>you already understand the UX</li></ul><p>Now your brain focuses only on SwiftUI syntax and patterns.</p><p>This is the fastest way to become productive.</p><p>– -</p><p># Suggested Learning Roadmap</p><p>## Phase 1 – Learn Layouts</p><p>Focus only on:</p><ul><li>VStack</li><li>HStack</li><li>ZStack</li><li>Spacer</li><li>Padding</li><li>frame</li></ul><p>Practice:</p><ul><li>Login screen</li><li>Settings screen</li><li>Profile card</li></ul><p>Ignore architecture initially.</p><p>– -</p><p>## Phase 2 – Learn State Management</p><p>Learn:</p><ul><li>@State</li><li>@Binding</li></ul><p>Build:</p><ul><li>Counter app</li><li>Toggle interactions</li><li>Expand/collapse UI</li><li>Form validation</li></ul><p>– -</p><p>## Phase 3 – Lists and Navigation</p><p>Learn:</p><ul><li>List</li><li>ForEach</li><li>NavigationStack</li></ul><p>Build:</p><ul><li>Todo app</li><li>Contacts app</li><li>Notes app</li></ul><p>– -</p><p>## Phase 4 – Real App Architecture</p><p>Now move into:</p><ul><li>ObservableObject</li><li>@StateObject</li><li>@EnvironmentObject</li><li>MVVM</li><li>Networking</li><li>Async/Await</li></ul><p>At this point, SwiftUI starts feeling natural.</p><p>– -</p><p># The Biggest Mistake UIKit Developers Make</p><p>Trying to control SwiftUI like UIKit.</p><p>Examples:</p><ul><li>storing view references</li><li>manually refreshing UI</li><li>forcing lifecycle patterns</li><li>thinking in constraints</li></ul><p><strong>SwiftUI works best when:</strong></p><ul><li>views are lightweight</li><li>state drives UI</li><li>UI becomes disposable</li><li>rendering is automatic</li></ul><p>– -</p><p># A Simple SwiftUI Thinking Framework</p><p>Whenever you build a new screen, ask yourself 3 questions:</p><p>## 1. What data drives this screen?</p><p>Examples:</p><ul><li>isLoading</li><li>username</li><li>products</li><li>isExpanded</li></ul><p>– -</p><p>## 2. What should UI look like for each state?</p><pre>if isLoading { ProgressView() } else { ProductList() } </pre><p>– -</p><p>## 3. What actions change the state?</p><pre>Button(“Load”) { isLoading = true } </pre><p><strong>That’s essentially how most SwiftUI apps work.</strong></p><p>– -</p><p># Final Thoughts</p><p>SwiftUI becomes much easier once you stop asking:</p><p>&gt; “How do I update the UI?”</p><p>And start asking:</p><p>&gt; “What state should this UI represent?”</p><p><strong>That single mental shift changes everything.</strong></p><p>If you already know UIKit, you’re not starting from zero.</p><p>You already understand:</p><ul><li>app architecture</li><li>user experience</li><li>component design</li><li>mobile engineering principles</li></ul><p>Now you’re simply learning a new way to describe interfaces.</p><p><strong>And once the declarative mindset clicks, SwiftUI becomes incredibly enjoyable to work with.</strong></p><p>– -</p><p># Recommended Resources</p><p>### Apple Documentation</p><ul><li><a href="https://developer.apple.com/tutorials/swiftui">SwiftUI Tutorials by Apple</a></li><li><a href="https://developer.apple.com/documentation/swiftui">SwiftUI Documentation</a></li></ul><p>### Community Learning</p><ul><li><a href="https://www.hackingwithswift.com/100/swiftui">Hacking with Swift – SwiftUI</a></li><li><a href="https://youtube.com/@swiftfulthinking?si=bxQPJoF0Zj6fKKX5">Swiftful Thinking</a></li></ul><p>– -</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f711effc5f19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[App launch optimisations -]]></title>
            <link>https://medium.com/@vipandey54/app-launch-optimisations-2b33f76da1e0?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b33f76da1e0</guid>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[ios-development]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Mon, 18 May 2026 18:36:46 GMT</pubDate>
            <atom:updated>2026-05-18T18:36:46.167Z</atom:updated>
            <content:encoded><![CDATA[<p>“Users decide how they feel about your app within the first few seconds.”</p><p>Not after exploring all features.</p><p>Not after reading your release notes.</p><p>Not after seeing your architecture diagrams.</p><p>It starts the moment the app launches.</p><p>And honestly, as iOS developers, we sometimes underestimate how important that first experience is.</p><p>A slow launch screen…</p><p>A frozen UI…</p><p>A blank white screen for 3 seconds…</p><p>That’s enough for users to feel:</p><p>&gt; “This app feels heavy.”</p><p>Over the years working on mobile applications across Native iOS, React Native integrations, and enterprise ecosystems, one thing has become very clear:</p><p>App launch performance is not just an optimization task.</p><p>It’s an architecture responsibility.</p><p>Most launch issues don’t happen because developers wrote “bad code.”</p><p>They happen because the app is trying to do too much before showing the first screen.</p><p>Common mistakes I’ve seen in real projects:</p><p>❌ Initializing every SDK during startup</p><p>❌ Running synchronous API calls on launch</p><p>❌ Heavy database reads on the main thread</p><p>❌ Large dependency injection setup</p><p>❌ Massive analytics/logging initialization</p><p>❌ Complex storyboard rendering</p><p>❌ React Native bridge loading too early</p><p>The result?</p><p>Cold start time increases…</p><p>UI responsiveness drops…</p><p>And users immediately notice it.</p><p>One principle changed the way I think about startup optimization:</p><p>&gt; “Launch fast. Load smart.”</p><p>Your app does not need to prepare the entire world before rendering the first screen.</p><p>The goal should be simple:</p><ul><li>Show UI quickly</li><li>Keep the main thread free</li><li>Defer non-critical work</li><li>Make the app feel responsive instantly</li></ul><p>Here are a few optimizations that actually make a real difference in production apps 👇</p><p>1️⃣ Keep didFinishLaunching Lightweight</p><p>This is one of the biggest mistakes in iOS apps.</p><p>Many teams overload didFinishLaunchingWithOptions with:</p><ul><li>SDK setup</li><li>migrations</li><li>dependency graph creation</li><li>analytics initialization</li><li>remote config fetches</li></ul><p>But startup should only initialize what is required for the first visible screen.</p><p>Everything else can wait.</p><p>2️⃣ Lazy Load Wherever Possible</p><p>Not every service deserves launch-time initialization.</p><p>In many apps, things like:</p><ul><li>logging</li><li>feature flags</li><li>analytics</li><li>secondary modules</li><li>experimentation frameworks</li></ul><p>can initialize after the app becomes interactive.</p><p>Small changes here can reduce startup time significantly.</p><p>3️⃣ Protect the Main Thread</p><p>This is huge.</p><p>A lot of startup lag comes from blocking the main thread with:</p><ul><li>JSON parsing</li><li>database operations</li><li>image processing</li><li>file reads</li><li>unnecessary synchronous work</li></ul><p>Users may not know what a “main thread” is…</p><p>…but they definitely feel when it’s blocked.</p><p>4️⃣ Measure Before Optimizing</p><p>One thing I learned over time:</p><p>&gt; “Performance optimization without profiling is mostly guessing.”</p><p>Use Xcode Instruments properly:</p><p>✅ Time Profiler</p><p>✅ App Launch Instrument</p><p>✅ Main Thread Checker</p><p>✅ Memory Graph</p><p>Sometimes the bottleneck is completely different from what the team assumes.</p><p>5️⃣ Be Careful with Third-Party SDKs</p><p>Modern apps often integrate:</p><ul><li>analytics tools</li><li>marketing platforms</li><li>engagement frameworks</li><li>crash reporting systems</li></ul><p>Every SDK adds startup cost.</p><p>As engineers, we should continuously ask:</p><p>&gt; “Is this SDK worth the launch overhead it introduces?”</p><p>Because over time, these small additions quietly slow down the app.</p><p>6️⃣ Hybrid Apps Need Extra Attention</p><p>In React Native or hybrid architectures, launch optimization becomes even more critical.</p><p>Bridge initialization, JavaScript bundle loading, and embedded web rendering can heavily impact startup time if orchestration is not designed carefully.</p><p>This is where strong native architecture still matters a lot.</p><p>At the end of the day, users may never compliment your architecture directly…</p><p>But they absolutely notice:</p><p>✅ smooth startup</p><p>✅ instant responsiveness</p><p>✅ fluid interactions</p><p>And those small performance wins create trust.</p><p>A fast app feels:</p><ul><li>reliable</li><li>polished</li><li>premium</li></ul><p>That first impression matters more than many teams realize.</p><p>Performance engineering is no longer a “nice-to-have” skill for senior mobile engineers.</p><p>It is becoming part of the core craft.</p><p>#iOS #Swift #SwiftUI #MobileDevelopment #PerformanceOptimization #Xcode #SoftwareEngineering #ReactNative #AppArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b33f76da1e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Native(iOS/Android) Vs Responsive Web App]]></title>
            <link>https://medium.com/@vipandey54/native-ios-android-vs-responsive-web-app-15d907d0c740?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/15d907d0c740</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sun, 17 May 2026 16:38:38 GMT</pubDate>
            <atom:updated>2026-05-17T16:38:38.723Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How to choose ??</strong></p><p>Choose Native App when:</p><p>. Performance, UX, offline support, or device integration matters</p><p>. You are building long-term customer engagement</p><p>. Your product is feature-heavy or real-time</p><p>Choose Responsive Web App when:</p><p>. Speed-to-market and lower cost are priorities</p><p>. Your app is mostly content/forms/dashboard based</p><p>. You want instant updates without app-store dependency</p><p>Practical rule used in companies</p><p>Go Native if your app needs:</p><ul><li>Camera-heavy workflows</li><li>Real-time interactions</li><li>Bluetooth/NFC</li><li>Background processing</li><li>Smooth animations</li><li>Offline-first capability</li><li>High engagement &amp; retention</li></ul><p>Go Responsive Web if your app is:</p><ul><li>Mostly CRUD/dashboard/forms</li><li>Admin portal</li><li>B2B operations tool</li><li>Content or education platform</li><li>Early-stage validation product</li><li>Budget constrained</li></ul><p>Modern strategy many companies use</p><p>A very common enterprise strategy is:</p><ol><li>Start with:</li></ol><p>. Responsive Web App</p><p>. Backend APIs</p><p>. Shared design system</p><p>2. Later add:</p><p>. Native iOS app</p><p>. Native Android app</p><p>. Only for high-value user journeys</p><p>This reduces risk and cost early.</p><p>Decision formula architects use</p><p>If these are important:</p><ul><li>UX</li><li>Performance</li><li>Offline</li><li>Engagement</li><li>Device capabilities</li></ul><p>→ Native wins.</p><p>If these are important:</p><ul><li>Cost</li><li>Speed</li><li>Reach</li><li>Easy maintenance</li></ul><p>→ Responsive Web App wins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*nBAYxtnhDyZycWgJcdHrYg@2x.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15d907d0c740" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Core Data]]></title>
            <link>https://medium.com/@vipandey54/core-data-1fe021cd7fa?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fe021cd7fa</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[core-data]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Mon, 06 Feb 2023 19:09:49 GMT</pubDate>
            <atom:updated>2023-02-06T19:10:36.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1uxgq9k2YFuIR2LQmv5sg.jpeg" /></figure><p>Core Data is a framework in iOS that provides support for data management and persistence. It allows you to create, retrieve, update and delete data in a persistent store such as SQLite, XML or binary file.</p><p>A Core Data Stack consists of the following components:</p><ol><li>Managed Object Model: A schema that describes the entities and relationships in the data model.</li><li>Persistent Store Coordinator: Responsible for coordinating with the persistent store to save and retrieve data.</li><li>Managed Object Context: A scratchpad in memory that allows you to perform changes to the data.</li><li>Persistent Store: The actual storage location for the data, could be a file on disk or a database.</li></ol><p><strong>CRUD operations (Create, Read, Update, Delete)</strong> are the basic operations that can be performed on data in a database. In Core Data, you can perform these operations as follows:</p><ol><li>Create: To create a new object, you create an instance of the entity description, set its properties, and save it to the managed object context.</li></ol><pre>let entity = NSEntityDescription.insertNewObject(forEntityName: &quot;EntityName&quot;, into: context)<br>entity.setValue(&quot;Value&quot;, forKey: &quot;attribute&quot;)<br>try context.save()</pre><p>2. Read: To retrieve data from Core Data, you use a fetch request to retrieve objects from the managed object context.</p><pre>let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: &quot;EntityName&quot;)<br>request.predicate = NSPredicate(format: &quot;attribute = %@&quot;, &quot;Value&quot;)<br>let result = try context.fetch(request)</pre><p>3. Update: To update an existing object, you modify its properties and save the changes to the managed object context.</p><pre>let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: &quot;EntityName&quot;)<br>request.predicate = NSPredicate(format: &quot;attribute = %@&quot;, &quot;Value&quot;)<br>let result = try context.fetch(request)<br>if let entity = result.first as? NSManagedObject {<br>    entity.setValue(&quot;NewValue&quot;, forKey: &quot;attribute&quot;)<br>    try context.save()<br>}</pre><p>4. Delete: To delete an object, you simply call the delete method on the managed object context and save the changes.</p><pre>let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: &quot;EntityName&quot;)<br>request.predicate = NSPredicate(format: &quot;attribute = %@&quot;, &quot;Value&quot;)<br>let result = try context.fetch(request)<br>if let entity = result.first as? NSManagedObject {<br>    context.delete(entity)<br>    try context.save()<br>}</pre><p>Core Data provides the following features:</p><ol><li>Object Modeling: Allows you to define your data model using entities and relationships, similar to a database schema.</li><li>Object Management: Facilitates the creation, retrieval, and manipulation of objects, as well as undo and redo functionality.</li><li>Persistence: Automatically saves changes made to data and handles the low-level details of saving and retrieving data from disk.</li><li>Versioning and Migration: Supports versioning of your data model and provides tools for migrating data between versions.</li><li>Performance Optimization: Offers built-in features to optimize data access, such as caching and faulting, to ensure fast and efficient performance.</li></ol><p>Using Core Data, you can manage your application’s data in a flexible and efficient way, while preserving its integrity and allowing for easy retrieval and manipulation.</p><h3><strong>Core Data Versioning:</strong></h3><p><strong>Core Data versioning</strong> refers to the process of managing changes to the data model over time in an application. With Core Data, you can define multiple versions of your data model and transition from one version to another. This allows you to evolve your data model over time while preserving the user’s data.</p><p>There are two ways to handle versioning in Core Data: <strong>lightweight migration and manual migration.</strong></p><ol><li>Lightweight Migration: Lightweight migration is the easiest way to handle versioning. It automatically updates the data model to the new version, preserving existing data. Lightweight migration is only possible if the changes to the data model are simple and non-destructive, such as adding or removing an attribute.</li><li>Manual Migration: Manual migration is required when the changes to the data model are more complex, such as changing the type of an attribute or renaming an entity. With manual migration, you write custom code to migrate the data from one version of the data model to another.</li></ol><p>To perform versioning in Core Data, you need to do the following steps:</p><ol><li>Create a new version of your data model in the XCode Data Model Editor.</li><li>Update the persistent store coordinator to use the new version of the data model.</li><li>Optionally, write custom code to handle manual migration if necessary.</li></ol><p>Here is an example of how to perform a lightweight migration in Core Data:</p><pre>let container = NSPersistentContainer(name: &quot;MyModel&quot;)<br>let storeDescription = NSPersistentStoreDescription(url: storeURL)<br>storeDescription.shouldMigrateStoreAutomatically = true<br>storeDescription.shouldInferMappingModelAutomatically = true<br>container.persistentStoreDescriptions = [storeDescription]<br>container.loadPersistentStores { (storeDescription, error) in<br>    if let error = error {<br>        print(&quot;Unresolved error \(error), \(error.userInfo)&quot;)<br>    }<br>}</pre><p>In this example, we set the shouldMigrateStoreAutomatically and shouldInferMappingModelAutomatically properties to true, which tells Core Data to perform a lightweight migration if necessary. Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fe021cd7fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WKWebview]]></title>
            <link>https://medium.com/@vipandey54/wkwebview-9bfee586a91b?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bfee586a91b</guid>
            <category><![CDATA[wkwebview]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[webview]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Mon, 06 Feb 2023 18:49:58 GMT</pubDate>
            <atom:updated>2023-02-06T18:49:58.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*zIrAjp5EEkOAAZQnoBcGdw.png" /></figure><p>WKWebView is a powerful component introduced by Apple in 2014 to allow iOS and MacOS developers to embed web content into their native apps. It is a replacement for the older UIWebView component, and offers many improved features such as faster performance, better security, and modern HTML5 compatibility.</p><p>Here’s an example of how to implement a basic WebView and a transition to another page within the WebView in Swift:</p><pre>import WebKit<br><br>class ViewController: UIViewController, WKNavigationDelegate {<br><br>    var webView: WKWebView!<br><br>    override func loadView() {<br>        webView = WKWebView()<br>        webView.navigationDelegate = self<br>        view = webView<br>    }<br><br>    override func viewDidLoad() {<br>        super.viewDidLoad()<br><br>        let url = URL(string: &quot;https://www.example.com&quot;)!<br>        webView.load(URLRequest(url: url))<br>        webView.allowsBackForwardNavigationGestures = true<br>    }<br><br>    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {<br>        title = webView.title<br>    }<br><br>    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {<br><br>        if navigationAction.navigationType == .linkActivated {<br>            if let url = navigationAction.request.url,<br>               let host = url.host, !host.hasPrefix(&quot;www.example.com&quot;) {<br>                UIApplication.shared.open(url)<br>                decisionHandler(.cancel)<br>                return<br>            }<br>        }<br><br>        decisionHandler(.allow)<br>    }<br>}</pre><p>The above code sets up a basic WKWebView and sets the view controller as its navigation delegate. The view controller’s loadView method creates and configures the web view, and the viewDidLoad method loads a URL into the web view. The webView(_:didFinish:) method sets the title of the view controller to match the title of the web page.</p><p>The webView(_:decidePolicyFor:decisionHandler:) method is called when the web view is about to load a new page. If the new page is a link activation, the method checks if the host of the URL is a different domain. If it is, the method opens the URL in the default browser using UIApplication.shared.open(url) and cancels the navigation within the web view. If it&#39;s not a different domain, the method allows the navigation to proceed within the web view.</p><p>This is just a basic example of how to implement a WKWebView in Swift. There are many other features you can explore, such as customizing the user agent, handling SSL certificate errors, or enabling back and forward navigation gestures. You can also interact with the web content using JavaScript and evaluate JavaScript code from your Swift code.</p><p>Overall, WKWebView provides a convenient and powerful way to embed web content into your iOS and MacOS apps. Whether you need to display a website, an HTML5 game, or a hybrid app that mixes native and web components, WKWebView is a great choice for your app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bfee586a91b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Sum]]></title>
            <link>https://medium.com/@vipandey54/two-sum-613311c8eece?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/613311c8eece</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[two-sum]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 18:29:46 GMT</pubDate>
            <atom:updated>2023-02-05T18:29:46.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBqr6glFUxL_IgE9jGsn5A.jpeg" /></figure><p>Two Sum is a popular problem in computer science and software engineering. The problem statement is as follows:</p><p>Given an array of integers, find two numbers such that they add up to a specific target number.</p><p>The solution to this problem can be found using two different approaches:</p><ol><li>Brute Force Solution: In this approach, we compare each number in the array with all the other numbers in the array. If two numbers add up to the target, then return the indices of the two numbers in the array.</li><li>HashMap Solution: In this approach, we store the numbers in a hashmap and check if the complement of the target number is in the hashmap. If yes, then return the indices of the two numbers in the array.</li></ol><p>Let’s take a look at the solution in Swift for both of these approaches.</p><ol><li>Brute Force Solution:</li></ol><pre>func twoSum(_ nums: [Int], _ target: Int) -&gt; [Int] {<br>    for i in 0..&lt;nums.count {<br>        for j in (i+1)..&lt;nums.count {<br>            if nums[i] + nums[j] == target {<br>                return [i, j]<br>            }<br>        }<br>    }<br>    return []<br>}</pre><p>2. HashMap Solution:</p><pre>func twoSum(_ nums: [Int], _ target: Int) -&gt; [Int] {<br>    var map = [Int: Int]()<br>    for (index, num) in nums.enumerated() {<br>        let complement = target - num<br>        if let indexOfComplement = map[complement] {<br>            return [indexOfComplement, index]<br>        }<br>        map[num] = index<br>    }<br>    return []<br>}</pre><p>The hashmap solution is more efficient compared to the brute force solution as it takes O(n) time complexity while the brute force solution takes O(n²) time complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=613311c8eece" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fizz Buzz]]></title>
            <link>https://medium.com/@vipandey54/fizz-buzz-44237467563e?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/44237467563e</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[fizzbuzz]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 18:18:39 GMT</pubDate>
            <atom:updated>2023-02-05T18:18:39.886Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDtZ9uW9j9iu88prnABCcA.jpeg" /></figure><p>The Fizz Buzz problem is a classic programming interview question. The problem statement is as follows:</p><p>Write a program that prints the numbers from 1 to N, where N is provided as input. But for multiples of 3, the program should print “Fizz” instead of the number, and for the multiples of 5, it should print “Buzz”. For numbers which are multiples of both 3 and 5, the program should print “FizzBuzz”.</p><p>Here is a solution to the Fizz Buzz problem in Swift:</p><pre>func fizzBuzz(_ n: Int) {<br>    for i in 1...n {<br>        if i % 3 == 0 &amp;&amp; i % 5 == 0 {<br>            print(&quot;FizzBuzz&quot;)<br>        } else if i % 3 == 0 {<br>            print(&quot;Fizz&quot;)<br>        } else if i % 5 == 0 {<br>            print(&quot;Buzz&quot;)<br>        } else {<br>            print(i)<br>        }<br>    }<br>}</pre><p>This solution uses a for loop to iterate through the numbers from 1 to N and check if each number is a multiple of 3, 5, or both. If the number is a multiple of 3 and 5, the program prints “FizzBuzz”. If it’s a multiple of 3, it prints “Fizz”, and if it’s a multiple of 5, it prints “Buzz”. For all other numbers, the program simply prints the number.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44237467563e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GIT]]></title>
            <link>https://medium.com/@vipandey54/git-aeb8afee1c81?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeb8afee1c81</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 19:15:14 GMT</pubDate>
            <atom:updated>2023-02-04T19:15:14.399Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*BCZkmZR1_YzDZy22Vn4uUw.png" /></figure><p>Git: A Game-Changer in the World of Version Control</p><p>Git is an open-source, distributed version control system that has revolutionized the way developers work on projects. It was created by Linus Torvalds in 2005, with the purpose of enabling efficient collaboration and management of software development.</p><p>Git operates on the principle of storing and managing snapshots of your code instead of just storing individual files and changes. This makes it possible to track changes, revert back to previous versions, and collaborate on projects with multiple contributors.</p><p>The Benefits of Using Git</p><p>Git offers numerous benefits for software developers, including:</p><ol><li>Distributed Version Control: With Git, developers can work on the same project simultaneously, and the changes made by one developer will not affect the work of others. Each contributor has a complete copy of the codebase, and all changes are merged together.</li><li>Robust and Efficient: Git uses a sophisticated algorithm to manage code changes, which makes it fast and reliable. It saves a snapshot of every change made to the code, and it is easy to revert back to a previous version if required.</li><li>Easy Collaboration: Git makes it simple to collaborate with other developers. With Git, it is possible to work on a project together, and each contributor can make changes and merge them into the main codebase.</li><li>Community Support: Git has a large and active community, which means that developers can easily find help and support for any problems they encounter.</li><li>Free and Open Source: Git is free and open-source, which means that developers can use it for any purpose, and they are free to modify and distribute it.</li></ol><p><strong>How Git Works</strong></p><p>Git works by creating a repository for your project, which stores snapshots of your code. You can add changes to your repository by committing them. Each commit creates a new version of your code, and you can revert back to any previous version if required.</p><p>Git also supports branching, which means that you can work on multiple versions of your code simultaneously. This is particularly useful when working on large projects, as it enables you to make changes to one branch without affecting the main codebase.</p><p>When you are ready to merge your changes into the main codebase, you can do so using Git’s merge function. Git will automatically resolve any conflicts that arise and create a new version of the code that includes all changes.</p><p>In this blog, we will cover some of the basic Git commands that you can use in the Mac terminal.</p><ol><li><strong>git init</strong>: This command is used to initialize a Git repository in your current working directory. It creates a hidden directory called .git that tracks all your changes to the files in your project.</li><li>git clone: This command is used to clone an existing repository from a remote source. It creates a local copy of the repository on your computer. The syntax is as follows: <strong>git clone [remote repository URL]</strong>.</li><li>git add: This command is used to add changes to the Git index. The changes can be new files or modifications to existing files. The syntax is as follows: <strong>git add [file name]</strong>.</li><li>git commit: This command is used to save changes to the repository. You must provide a commit message to describe the changes you have made. The syntax is as follows: <strong>git commit -m “[commit message]”</strong>.</li><li>git push: This command is used to upload changes from your local repository to a remote repository. The syntax is as follows: <strong>git push [remote repository name] [branch name]</strong>.</li><li>git pull: This command is used to download changes from a remote repository to your local repository. The syntax is as follows: <strong>git pull [remote repository name] [branch name]</strong>.</li><li>git branch: This command is used to create, list, and delete branches. The syntax is as follows: <strong>git branch [branch name]</strong>.</li><li>git checkout: This command is used to switch between branches. The syntax is as follows: <strong>git checkout [branch name]</strong>.</li><li>git merge: This command is used to merge two branches together. The syntax is as follows: <strong>git merge [branch name]</strong>.</li><li><strong>git status</strong>: This command is used to check the status of the repository. It displays information about changes that have been made but have not been committed yet.</li></ol><p>In conclusion, these are some of the basic Git commands that you can use in the Mac terminal.</p><p>Git is a powerful version control system that has revolutionized the way developers work on projects.</p><p>With its robust, efficient, and easy-to-use features, Git has become the go-to solution for developers who want to work collaboratively and efficiently.</p><p>Whether you are working on a large project or a small one, Git is the perfect solution for managing your code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeb8afee1c81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SSL pinning and it’s implementation in iOS application.]]></title>
            <link>https://medium.com/@vipandey54/ssl-pinning-and-its-implementation-in-ios-application-84c16104f230?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/84c16104f230</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ssl-pinning]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ssl]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 18:52:57 GMT</pubDate>
            <atom:updated>2023-02-04T18:52:57.881Z</atom:updated>
            <content:encoded><![CDATA[<p>SSL Pinning is a security mechanism used in mobile applications to ensure that the app communicates only with the intended server, protecting against man-in-the-middle attacks. SSL Pinning is the process of associating a host (website, API, etc.) with its expected X.509 certificate, or public key, thereby ensuring that the client only communicates with the intended server and not an impostor.</p><p>To enable SSL Pinning in Swift, you can follow these steps:</p><ol><li>Download the server’s certificate: To enable SSL Pinning, you will need to have the server’s SSL certificate. You can download it using the browser or the command line tool.</li><li>Create a data representation of the certificate: After downloading the certificate, you will need to create a data representation of it.</li><li>Add the certificate data to the app: Next, you will need to add the certificate data to the app. You can do this by creating a new Swift file and adding the certificate data as a constant.</li><li>Configure the app to use SSL Pinning: Once you have added the certificate data to the app, you will need to configure the app to use SSL Pinning. You can do this by adding the following code to the app’s delegate:</li></ol><pre>let session = URLSession(configuration: .default)<br>session.delegate = self</pre><p>5. Implement the URLSessionDelegate protocol: The final step is to implement the URLSessionDelegate protocol. You can do this by adding the following code to the app’s delegate:</p><pre>extension AppDelegate: URLSessionDelegate {<br>func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -&gt; Void) {<br>guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,<br>let serverTrust = challenge.protectionSpace.serverTrust else {<br>completionHandler(.cancelAuthenticationChallenge, nil)<br>return<br>}<br>guard let serverCertificate = SecTrustGetCertificateAtIndex(serverTrust, 0),<br>  let serverCertificateData = SecCertificateCopyData(serverCertificate) as Data?,<br>  serverCertificateData == certificateData else {<br>    completionHandler(.cancelAuthenticationChallenge, nil)<br>    return<br>}<br><br>let credential = URLCredential(trust: serverTrust)<br>completionHandler(.useCredential, credential)<br>}<br>}</pre><p>This code will ensure that the app only communicates with the server that has the certificate data that you have added to the app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c16104f230" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automatic Reference Counting (ARC) in Swift]]></title>
            <link>https://medium.com/@vipandey54/automatic-reference-counting-arc-in-swift-7ec6e7e6ac4?source=rss-a592d40c9800------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ec6e7e6ac4</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Vikas Pandey]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 18:42:10 GMT</pubDate>
            <atom:updated>2023-02-04T18:42:10.349Z</atom:updated>
            <content:encoded><![CDATA[<p>Automatic Reference Counting (ARC) is a memory management technique in Swift programming language. It automatically tracks and manages the lifecycle of objects, freeing up memory once they are no longer needed.</p><p>ARC works by keeping track of the number of references to an object. An object has a reference count of one when it is first created. When a reference to the object is created, the reference count increases by one. When the reference goes out of scope or is set to nil, the reference count decreases by one. When the reference count reaches zero, the object is automatically deallocated.</p><p>ARC can simplify memory management in Swift, but it requires a good understanding of its behavior to use effectively. For example, strong reference cycles can occur when two objects hold strong references to each other, leading to a memory leak. To avoid these, you can use weak and unowned references in specific cases.</p><p>Here is a simple example to demonstrate the use of ARC in Swift:</p><pre>class Person {<br>    let name: String<br>    init(name: String) {<br>        self.name = name<br>    }<br>    deinit {<br>        print(&quot;\(name) is being deinitialized&quot;)<br>    }<br>}<br><br>var person1: Person?<br>var person2: Person?<br><br>person1 = Person(name: &quot;Vikas&quot;)<br>person2 = person1<br><br>person1 = nil<br>person2 = nil</pre><p>In this example, two variables person1 and person2 are declared with the type Person. A Person object is created and assigned to person1. Then, person2 is assigned to person1, which increases the reference count of the Person object to two.</p><p>When person1 is set to nil, the reference count decreases by one. When person2 is also set to nil, the reference count reaches zero and the Person object is deallocated.</p><p>ARC is an important concept in Swift programming and helps ensure that your app does not leak memory. Understanding the behavior of ARC and how it interacts with the different types of references can help you write more efficient and memory-safe code in Swift.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ec6e7e6ac4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>