title: SwiftUI Navigation automatically closing/pop - Realm
body: <p>I'm populating a List with a Realm Result set.</p>
  
  <p>When navigating from this list it opens a new view then automatically closes that view.</p>
  
  <p>Using a struct presents no issue.</p>
  
  <p>Why would the second view automatically close?</p>
  
  <p>I have a screen recording but cant post here.</p>
  
  <pre><code>import SwiftUI
  import Combine
  
  struct TestStruct:Identifiable{
  
      let id = UUID()
      let firstname: String
  }
  
  extension TestStruct {
      static func all() -&gt; [TestStruct]{
          return[
              TestStruct(firstname: "Joe"),
              TestStruct(firstname: "Jane"),
              TestStruct(firstname: "Johns")
          ]
      }
  }
  
  struct TestListView: View {
      let realmList = Horoscope.getHoroscopes() //Fetches from Realm
      let structList = TestStruct.all()
  
      var body: some View {
          NavigationView{
              // This owrks
              //            List(structList) { item in
              //                MyItemRow(itemTxt: item.firstname)
              //            }
  
              //This automatically closes the view
              List(realmList) { item in
                  MyItemRow(itemTxt: item.firstname)
              }
              .navigationBarTitle("Charts", displayMode: .automatic)
              .navigationBarItems(trailing: EditButton())
          }
      }
  }
  
  
  struct MyItemRow: View {
  
      var itemTxt:String
  
      var body: some View {
          NavigationLink(destination: Text("Test")) {
              Text(itemTxt)
          }
      }
  }
  
  struct TestListView_Previews: PreviewProvider {
      static var previews: some View {
          TestListView()
      }
  }
  </code></pre>