title: SwiftUI: View doesnt update when Data added to Realm DB through Sheet
body: <p>I am having a very irritating problem, with my view and Realm DB. So I have a very simple code, I have a view were I display the stored Names in my Realm DataBase. These Names are stored by navigating to another view through a navigationlink.</p>
  <p>In this view a name is written in a Textfield and stored to the DB. When I go back to my original View the name isnt being displayed, so I have to rerender my Simulator for it to update and display the recently added Name.</p>
  <p><em><strong>Any ideas on how to solve this issue?</strong></em></p>
  <p>This is my code:</p>
  <p><em><strong>This is my main view, where the names should be displayed:</strong></em></p>
  <pre><code>class Name: Object, ObjectKeyIdentifiable {
      @Persisted(primaryKey: true) var id: ObjectId
      @Persisted var name = &quot;&quot;
  }
  
  
  struct playground: View {
      
      @StateObject var nameManager = NameManager()
      @State var myName = &quot;&quot;
      @State var showSheet = false
      
      
      var body: some View {
          NavigationView{
              VStack{
                  NavigationLink(destination: dataView(myName: $myName)) {
                      Text(&quot;go to another view to write name &quot;)
                  }
                  
                  
                  ForEach(nameManager.names, id: \.id) {name in
                      Text(&quot;\(name.name)&quot;)
                          .onTapGesture {
                              nameManager.deleteName(id: name.id)
                          }
                  }
                  
              }.sheet(isPresented: $showSheet) {
                  dataView(myName: $myName)
              }
          }
      }
  }
  </code></pre>
  <p><em><strong>And this is the view im using to write the name and store it:</strong></em></p>
  <pre><code>struct dataView: View {
      @Binding var myName : String
      @StateObject var nameManager = NameManager()
      
      
      var body: some View {
          
          VStack{
              TextField(&quot;Enter username...&quot;, text: $myName)
              
              
              Button(&quot;store to DB&quot;) {
                  nameManager.addName(name: myName)
                  myName = &quot;&quot;
                  
                  
              }
          }
          
      }
  }
  </code></pre>