<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Simran Preet Singh</title>
    <description>The latest articles on DEV Community by Simran Preet Singh (@simrandotdev).</description>
    <link>https://dev.to/simrandotdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F128833%2Fef15a5d3-ed22-448c-82ea-5ade8a057cd9.jpg</url>
      <title>DEV Community: Simran Preet Singh</title>
      <link>https://dev.to/simrandotdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/simrandotdev"/>
    <language>en</language>
    <item>
      <title>SwiftUI Fix: Cannot Convert Binding&lt;String?&gt; to Binding&lt;String&gt; in TextField</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Fri, 30 May 2025 15:14:42 +0000</pubDate>
      <link>https://dev.to/simrandotdev/swiftui-fix-cannot-convert-bindingstring-to-binding-in-textfield-5h5f</link>
      <guid>https://dev.to/simrandotdev/swiftui-fix-cannot-convert-bindingstring-to-binding-in-textfield-5h5f</guid>
      <description>&lt;p&gt;While working with &lt;code&gt;TextField&lt;/code&gt; in SwiftUI, you might come across the following error:&lt;/p&gt;

&lt;p&gt;Cannot convert value of type 'Binding' to expected argument type 'Binding'&lt;/p&gt;

&lt;p&gt;This is a common issue when you're trying to bind a &lt;code&gt;TextField&lt;/code&gt; to an optional &lt;code&gt;String?&lt;/code&gt;, like in this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kt"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Address 2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$viewModel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;business&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, address2 is most likely declared as an optional string (String?), but TextField expects a non-optional Binding. Let’s walk through why this error happens and how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Happens
&lt;/h2&gt;

&lt;p&gt;SwiftUI's TextField requires a binding to a concrete String, because it needs to show and update text consistently. Optional values introduce uncertainty: should the field show nil, an empty string, or something else?&lt;/p&gt;

&lt;p&gt;That’s why you see this error — SwiftUI doesn’t know what to do with a Binding.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution 1: Manual Binding with Default Value
&lt;/h3&gt;

&lt;p&gt;You can manually create a Binding from a Binding using Swift’s computed bindings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TextField("Address 2", text: Binding(
    get: { viewModel.business.address2 ?? "" },
    set: { viewModel.business.address2 = $0 }
))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  What This Does:
&lt;/h4&gt;

&lt;p&gt;get: Returns the optional value if it exists, or an empty string if it's nil.&lt;/p&gt;

&lt;p&gt;set: Updates the original optional with the new value from the text field.&lt;/p&gt;

&lt;p&gt;This safely bridges the gap between the optional address2 and what TextField expects.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧼 Bonus: Make It Reusable with an Extension
&lt;/h3&gt;

&lt;p&gt;If you find yourself writing this conversion often, you can add a helpful extension:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extension Binding where Value == String? {
    func orEmpty() -&amp;gt; Binding&amp;lt;String&amp;gt; {
        Binding&amp;lt;String&amp;gt;(
            get: { self.wrappedValue ?? "" },
            set: { self.wrappedValue = $0 }
        )
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TextField("Address 2", text: $viewModel.business.address2.orEmpty())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ios</category>
      <category>swiftui</category>
    </item>
    <item>
      <title>Core Data Part 2 Components of Core Data - NSPersistentContainer</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Mon, 08 Apr 2024 00:58:28 +0000</pubDate>
      <link>https://dev.to/simrandotdev/core-data-part-2-components-of-core-data-nspersistentcontainer-50h5</link>
      <guid>https://dev.to/simrandotdev/core-data-part-2-components-of-core-data-nspersistentcontainer-50h5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the first article we learnt about data model and created our &lt;code&gt;xcdatamodeld&lt;/code&gt; file which holds all our Core Data models in it. In this article we will explore what is &lt;code&gt;NSPersistentContainer&lt;/code&gt; and what role does it play in the Core Data stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  NSPersistentContainer
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;NSPersistentContainer&lt;/code&gt; is the class that is responsible for actually persisting and reading the data from the permanent data store. This class creates the data store which may be SQLite, some flat file system or whatever it can. But we use this class to help us save the data and retrieve it from the data store.&lt;/p&gt;

&lt;p&gt;So we will use &lt;code&gt;NSPersistentContainer&lt;/code&gt; to load create the database and make sure everything work with data models we have created. We will create a new class &lt;code&gt;AppPersistenceContainer&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;Foundation&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;AppPersistentContainer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the object of &lt;code&gt;NSPersistentContainer&lt;/code&gt; and initialize it in &lt;code&gt;init&lt;/code&gt; of the class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;Foundation&lt;/span&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;CoreData&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;AppPersistenceContainer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="c1"&gt;// Step - 1: Create the object&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;persistenceContainer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;NSPersistentContainer&lt;/span&gt;

  &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Step - 2: Initialize the object&lt;/span&gt;
    &lt;span class="n"&gt;persistenceContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;NSPersistentContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"CoreDataExampleModel"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you look carefully in &lt;code&gt;Step - 2&lt;/code&gt; we are using the exact name of the &lt;code&gt;xcdatamodeld&lt;/code&gt; file in the initializer. Make sure it matches your &lt;code&gt;xcdatamodeld&lt;/code&gt; file name without the extension.&lt;/p&gt;

&lt;p&gt;Not lets initialize the &lt;code&gt;AppPersistenceContainer&lt;/code&gt; class in &lt;code&gt;CoreDataExampleApp.swift&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;SwiftUI&lt;/span&gt;

&lt;span class="kd"&gt;@main&lt;/span&gt;
&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;CoreDataExampleApp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;App&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="c1"&gt;// Add this line.&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;appPersistentContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;AppPersistenceContainer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;Scene&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;WindowGroup&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if everything is correct your app should build and run fine. You won't see anything much on the screen as we have not created on data and done anything to show data on the view. But the logs should not show any error. &lt;/p&gt;

&lt;p&gt;But if you have named the data model incorrectly in &lt;code&gt;NSPersistentContainer(name: String)&lt;/code&gt; then you will see the following error in the logs. App won't crash or anything but things won't work as expected if try to load or save any data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzr8m7wgu54jd9ntn0tc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzr8m7wgu54jd9ntn0tc.png" alt="Image description" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;There is one more step we can do to make 100% sure that the persistent store has been loaded or if there is error we can handle it gracefully. Now after we have initialized &lt;code&gt;NSPersistentContainer&lt;/code&gt; in the &lt;code&gt;init&lt;/code&gt; of &lt;code&gt;AppPersistenceContainer&lt;/code&gt; add this line of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="n"&gt;persistenceContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loadPersistentStores&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"❌ ERROR: Failed to load persistent store with error: &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;localizedDescription&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your whole &lt;code&gt;AppPersistentContainer.swift&lt;/code&gt; class should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;Foundation&lt;/span&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;CoreData&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;AppPersistenceContainer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;persistenceContainer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;NSPersistentContainer&lt;/span&gt;

  &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;persistenceContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;NSPersistentContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"CoreDataExampleMode"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;persistenceContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loadPersistentStores&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"❌ ERROR: Failed to load persistent store with error: &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;localizedDescription&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code that we added just now, whats its doing is that it is loading the Persistent store and if it cannot for some reason, the error will be handled in the &lt;code&gt;loadPersistentStore&lt;/code&gt; closure.&lt;/p&gt;

&lt;p&gt;In the next article we learn more about &lt;code&gt;NSManagedObjectContext&lt;/code&gt; and how it is used to actually save objects of our &lt;code&gt;FolderEntity&lt;/code&gt; data model and save it.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>swift</category>
      <category>coredata</category>
    </item>
    <item>
      <title>Core Data Part 1 Components of Core Data - Data Model</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Mon, 08 Apr 2024 00:56:28 +0000</pubDate>
      <link>https://dev.to/simrandotdev/core-data-part-1-components-of-core-data-data-model-3de0</link>
      <guid>https://dev.to/simrandotdev/core-data-part-1-components-of-core-data-data-model-3de0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this series I will go briefly over the 3 main components of the Core Data Stack.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Model&lt;/li&gt;
&lt;li&gt;NSPersistentContainer&lt;/li&gt;
&lt;li&gt;NSManagedObjectContext&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First we will just go over what is DataModel and how to use it in our iOS Project with CoreData&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Model
&lt;/h2&gt;

&lt;p&gt;Defined in the &lt;code&gt;.xcdatamodeld&lt;/code&gt; file, this includes all the models that we want to have to store data in Core Data. For example if we want to have a &lt;code&gt;Folders&lt;/code&gt;, &lt;code&gt;Notes&lt;/code&gt; , &lt;code&gt;Tags&lt;/code&gt; models for a notes app, than these will be defined in the &lt;code&gt;.xcdatamodeld&lt;/code&gt; file. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;.xcdatamodeld&lt;/code&gt; just holds the information about how the data will look like. Which means it just holds the classes for those models, the properties in those classes and the relationship between. In holds no actual data to be store. It is simply like a group folder named &lt;code&gt;Models&lt;/code&gt; we create in XCode when we want to group our models classes or structs in a single place. But here these models are always classes as they need to be of reference type as other parts that we are gonna discuss later needs to track each reference and any changes done to them.&lt;/p&gt;

&lt;h3&gt;
  
  
  New iOS Project
&lt;/h3&gt;

&lt;p&gt;To create a data model lets create a new XCode project called &lt;code&gt;CoreDataExample&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyngrbhut6ejldzhg9ylz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyngrbhut6ejldzhg9ylz.png" alt="Image description" width="800" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure the storege is selected as &lt;code&gt;None&lt;/code&gt;. We will create everything from scratch so we are not selecting any pre-existing type of storage. As that gives a lot of boilerplate code that can be confusing to many.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv11hgyrsnaw7trwuij67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv11hgyrsnaw7trwuij67.png" alt="Image description" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we get a very empty SwiftUI project that has no way to store data permanently.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs7ry2ejuuz0kfgdiy9bx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs7ry2ejuuz0kfgdiy9bx.png" alt="Image description" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating &lt;code&gt;.xcdatamodeld&lt;/code&gt; in our project
&lt;/h3&gt;

&lt;p&gt;First we will create a new folder group in our project named &lt;code&gt;Models&lt;/code&gt;. Here we will keep the &lt;code&gt;xcdatamodeld&lt;/code&gt; file and all the related files which defines the models for Core Data, their extensions if any and any other helper model files we need in the app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft17na3wxrp7bo5whd55b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft17na3wxrp7bo5whd55b.png" alt="Image description" width="544" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now lets create a new file in the &lt;code&gt;Models&lt;/code&gt; folders and select &lt;code&gt;Data Model&lt;/code&gt; under &lt;code&gt;Core Data&lt;/code&gt; section in your file template window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8kkfvnyfkrkji88fx08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8kkfvnyfkrkji88fx08.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*** Now be very carefull here. Because the name that we give to this file is very important as we will use it later in the app to define other components of the Core Data stack. So name it in Pascal Case like a class and keep the name a bit simple to remember and find. I am naming it &lt;code&gt;CoreDataExampleModel.xcdatamodeld&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqcc0b64uy2m11brapay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqcc0b64uy2m11brapay.png" alt="Image description" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h3&gt;
  
  
  Creating our first Model/Entity in &lt;code&gt;.xcdatamodeld&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Now we have created our &lt;code&gt;.xcdatamodeld&lt;/code&gt; file which will store all our data models related to Core Data. We will follow a naming convention here which I personally use. You are free to not follow it and use your naming convention, but then please make sure that you make necessary changes in this series of articles later on. What I do is usually suffix my Core Data models with &lt;code&gt;Entity&lt;/code&gt; as it makes it easy to distinguish them from my other models in the project if I needs to create any later on.&lt;/p&gt;

&lt;p&gt;So lets create our first model here named &lt;code&gt;FolderEntity&lt;/code&gt;. Now open the &lt;code&gt;CoreDataExampleModel.xcdatamodeld&lt;/code&gt; file and you will see something like this in your XCode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr48rbhec2gzwmg2whuh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr48rbhec2gzwmg2whuh5.png" alt="Image description" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Now you need to add an Entity which simply means you are creating a class which will define your data model. You create a new Entity by clicking the following icon in the &lt;code&gt;xcdatamodeld&lt;/code&gt; file that you opened.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xn3zg1xfoovldrtxkbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xn3zg1xfoovldrtxkbc.png" alt="Image description" width="800" height="712"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Now you see an entity as been created with the name &lt;code&gt;Entity&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhvyhef8jd18p94ldxwue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhvyhef8jd18p94ldxwue.png" alt="Image description" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Just double click on it and rename to something else, in this case we will create an entity named &lt;code&gt;FolderEntity&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nmykcerrn39ldr4wc5x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nmykcerrn39ldr4wc5x.png" alt="Image description" width="400" height="816"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Now we would need to add an attribute to this entity which means we are adding a property to our class &lt;code&gt;FolderEntity&lt;/code&gt;.&lt;br&gt;
Click on the + icon in the &lt;code&gt;Attributes&lt;/code&gt; section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu6ew75wvc9jylgvuz7v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu6ew75wvc9jylgvuz7v.png" alt="Image description" width="800" height="157"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Now name the attribute to &lt;code&gt;title&lt;/code&gt; and select its type(data type) to be &lt;code&gt;String&lt;/code&gt;. We will explore other data types as well in upcoming articles but for right now we are keeping it simple here and using &lt;code&gt;String&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopfscc74eum2hqb3l82u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopfscc74eum2hqb3l82u.png" alt="Image description" width="786" height="756"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Now just make sure your project builds fine. This whole process has create a class named &lt;code&gt;FolderEntity&lt;/code&gt; with a property named &lt;code&gt;title&lt;/code&gt; underneath the &lt;code&gt;xcdatamodeld&lt;/code&gt; which is not directly visible to us. But if you projects builds trust me there is a class named &lt;code&gt;FolderEntity&lt;/code&gt; that now exists in your project somewhere hidden from your eyes. We will later also learn to create those classes as Swift files in your project, but not right now. &lt;/p&gt;

&lt;p&gt;In the next article we will explore what is &lt;code&gt;NSPersistentContainer&lt;/code&gt; and how to create one for our project. &lt;/p&gt;

</description>
      <category>coredata</category>
      <category>swift</category>
      <category>ios</category>
      <category>xcode</category>
    </item>
    <item>
      <title>SwiftUI - Open Deeplink url from your terminal</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Thu, 30 Mar 2023 21:02:26 +0000</pubDate>
      <link>https://dev.to/simrandotdev/swiftui-open-deeplink-url-from-your-terminal-c74</link>
      <guid>https://dev.to/simrandotdev/swiftui-open-deeplink-url-from-your-terminal-c74</guid>
      <description>&lt;p&gt;&lt;a href="https://simran.dev/2022/12/17/swiftui-open-deeplink-url-from-terminal/" rel="noopener noreferrer"&gt;Original Post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the longest time when I had to test deeplinks, I would send myself an email with the link and open gmail in the iPhone simulator. But thanks for &lt;a href="https://mastodon.social/@StewartLynch@iosdev.space" rel="noopener noreferrer"&gt;Stewart Lynch&lt;/a&gt; and his Navigation stack video I learnt a way to open deeplink urls from the terminal in my simulator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcrun simctl openurl booted &amp;lt;URL Scheme&amp;gt;://PathComponent1/PathComponent2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your &lt;code&gt;URL Scheme&lt;/code&gt; is defined under &lt;code&gt;Targets &amp;gt; Info &amp;gt; URL Types&lt;/code&gt; and &lt;code&gt;PathComponent&lt;/code&gt; can be anything that we want to read in our app to define where we want to go or what data is being sent from the Deep Link&lt;/p&gt;

</description>
      <category>xcode</category>
      <category>deeplink</category>
      <category>ios</category>
    </item>
    <item>
      <title>Removing specific fields from a Mongoose returned object</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Thu, 30 Mar 2023 20:59:42 +0000</pubDate>
      <link>https://dev.to/simrandotdev/removing-specific-fields-from-a-mongoose-returned-object-1i7c</link>
      <guid>https://dev.to/simrandotdev/removing-specific-fields-from-a-mongoose-returned-object-1i7c</guid>
      <description>&lt;p&gt;&lt;a href="https://simran.dev/2023/03/30/removing-fields-from-mongoose-response/" rel="noopener noreferrer"&gt;Original Post Link...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Very often we have the need to only read certain fields from the database. We might just need &lt;code&gt;username&lt;/code&gt; from a collection that has a bunch of other fields related to a &lt;code&gt;User&lt;/code&gt; as well or read all the fields except 1 or 2, like we would never want to return &lt;code&gt;password&lt;/code&gt; to the client when we are sending the &lt;code&gt;User&lt;/code&gt; object even when it is ecrypted. For such scenerios &lt;code&gt;Mongoose&lt;/code&gt; gives few different ways to include or exclude fields from the response we read from a &lt;code&gt;MongoDB&lt;/code&gt; collection. &lt;/p&gt;

&lt;h3&gt;
  
  
  Including a certain field
&lt;/h3&gt;

&lt;p&gt;If we want to include only 1 single field from a collection in the response we can use &lt;code&gt;.include("&amp;lt;field-name&amp;gt;")&lt;/code&gt; after the mongoose query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({}).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;username&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example will only return &lt;code&gt;username&lt;/code&gt; and &lt;code&gt;_id&lt;/code&gt; from the User collection. &lt;/p&gt;

&lt;h3&gt;
  
  
  Excluding a certain field
&lt;/h3&gt;

&lt;p&gt;If we want to exclude only 1 single field from a collection in the response we can use &lt;code&gt;.include("-&amp;lt;field-name&amp;gt;")&lt;/code&gt; after the mongoose query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({}).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-username&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example will exclude &lt;code&gt;username&lt;/code&gt; from the User collection and return all other fields. &lt;/p&gt;

&lt;h3&gt;
  
  
  Always remove a certain field when Mongoose Schema returns a response
&lt;/h3&gt;

&lt;p&gt;There are situations when we never want to return a field in the results from the &lt;code&gt;Mongoose&lt;/code&gt; query. In such situations &lt;code&gt;Mongoose&lt;/code&gt; itself provides us a way to modify its &lt;code&gt;JSON&lt;/code&gt; object at the schema level and we can modify it the way we want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;userSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toJSON&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toObject&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;userObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;userObject&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>mongodb</category>
      <category>express</category>
    </item>
    <item>
      <title>Free path to Android development - 0 to PRO</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Wed, 26 Jan 2022 19:09:19 +0000</pubDate>
      <link>https://dev.to/simrandotdev/free-path-to-android-development-0-to-pro-lb5</link>
      <guid>https://dev.to/simrandotdev/free-path-to-android-development-0-to-pro-lb5</guid>
      <description>&lt;p&gt;There are a lot paid courses and bootcamps that teach you Android development&lt;br&gt;
and an endless list youtube tutorials. But no where there is a clear path for&lt;br&gt;
someone completly new to it. In this blog post I am gonna compile all the resources&lt;br&gt;
that I have found over the years and some very recently that I think are great for&lt;br&gt;
anyone. They will be mentioned in the order I think you should follow them, but&lt;br&gt;
feel free to follow them as per your wish if you are already familiar with the&lt;br&gt;
topics covered in previous playlists.&lt;/p&gt;

&lt;p&gt;You will make creating almost 10 apps and will teach you all the best and latest&lt;br&gt;
practices that are recommended in Android world by Google and Android developers.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLVUm4IewkTXqwzuRXZisWg7shMTiQhUtz" rel="noopener noreferrer"&gt;The Kotlin Programming Language Course for Beginners&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;This playlist is by &lt;a href="https://twitter.com/donnfelker" rel="noopener noreferrer"&gt; Donn Felker&lt;/a&gt;.&lt;br&gt;
He is one of the greatest Android developers and has worked for so many&lt;br&gt;
great companies and helped them create their initial version of Android app.&lt;br&gt;
This playlist takes you from no Kotlin knowledge to an intermediate Kotlin developer.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLLgF5xrxeQQ22hiHI6mrW4XHMEyzQLhua" rel="noopener noreferrer"&gt;Getting Started with Android Development&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;This is one of the newer Android channels I found and the content on this channel&lt;br&gt;
is just awesome for a beginner. This playlist do not teach anything much about&lt;br&gt;
Android development, but get you setup with your Android development environment.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLLgF5xrxeQQ1TSchy0JQ_CYZVxw0qTf3J" rel="noopener noreferrer"&gt;Android Development: Layout &amp;amp; UI&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Another playlist likely will be the next few by &lt;a href="https://www.youtube.com/c/TheAndroidFactory" rel="noopener noreferrer"&gt;The Android Factory&lt;/a&gt;&lt;br&gt;
that will teach you the basics Android layout including different layouts and&lt;br&gt;
widgets, ScrollView and RecyclerView.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLLgF5xrxeQQ0zedy1oQZTENX2Vqplwh7s" rel="noopener noreferrer"&gt;Android Development: Our first App&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;In this playlist you will create your first functioning Android app combining&lt;br&gt;
the concepts learnt in the previous playlists + Fragments, SharedPreferences,&lt;br&gt;
Intents and navigation between activities.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLLgF5xrxeQQ2sEqrbHJprsSoPwper7jjX" rel="noopener noreferrer"&gt;Git &amp;amp; GitHub&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Nothing about Android here, but an essential skill for any developer is to learn&lt;br&gt;
source code control system. And git being the most popular one, you should just learn it.&lt;/p&gt;

&lt;p&gt;For full list of resources visit my &lt;a href="https://simran.app/2021/08/13/free-path-android-development-copy/" rel="noopener noreferrer"&gt;blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Short - Sheets in SwiftUI creates a new Environment</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Wed, 26 Jan 2022 19:05:58 +0000</pubDate>
      <link>https://dev.to/simrandotdev/short-sheets-in-swiftui-creates-a-new-environment-458l</link>
      <guid>https://dev.to/simrandotdev/short-sheets-in-swiftui-creates-a-new-environment-458l</guid>
      <description>&lt;p&gt;In SwiftUI we can inject objects at the environment level using &lt;code&gt;.environmentObject()&lt;/code&gt; modifier and use them using &lt;code&gt;@EnvironmentObject&lt;/code&gt; property wrapper. In a perfect world this environment object is available to all the subviews in that tree with certain exceptions.&lt;/p&gt;

&lt;p&gt;One of the exceptions is that when we create a new .sheet() in any of the subviews this environment object will NOT be available for for that sheet view and its children. To use them in the sheet view and its children you would have to inject it again using &lt;code&gt;.environmentObject().&lt;/code&gt;&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>apple</category>
      <category>swiftui</category>
    </item>
    <item>
      <title>I am learning Ruby on Rails</title>
      <dc:creator>Simran Preet Singh</dc:creator>
      <pubDate>Sat, 19 Sep 2020 04:36:44 +0000</pubDate>
      <link>https://dev.to/simrandotdev/i-am-learning-ruby-on-rails-9eo</link>
      <guid>https://dev.to/simrandotdev/i-am-learning-ruby-on-rails-9eo</guid>
      <description>&lt;p&gt;I am an iOS developer with experience in C# backend development. I want to create some iOS content on youtube to help people understand more about Networking in iOS apps without Firebase or other similar services. I have played around with ExpressJS in the last couple of years, but the moment I have to write Javascript it gives me a headache with its inconsistencies and bizarre different ways to do the same simple thing and every way has its own gotchas. &lt;/p&gt;

&lt;p&gt;So today I decided to learn Ruby and then Ruby on Rails for my future personal projects. I am excited and nervous at the same time. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
