title: @AppStorage property wrapper prevents from dismissing views
body: <p>I have an app with four (4) views, on the first view I'm showing a list of cars pulled from CoreData, the second view is presented when a car is tapped and it shows the services for each car. The third view is presented when tapping on a service, and it shows the details of the selected service. The fourth view is presented when tapping a button and it shows records for the specified service.</p>
  <p>The issue I'm having is that for some reason if I use an @AppStorage property wrapper within the ServicesView I cannot dismiss the fourth view (RecordsView). I don't think the issue is with CoreData but let me know if you need to see the code for Core Data.</p>
  <p><strong>Any idea why adding an @AppStorage property wrapper in the ServicesView would affect other views?</strong></p>
  <p><a href="https://i.stack.imgur.com/8fYfC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8fYfC.jpg" alt="enter image description here" /></a></p>
  <h2>CarsView</h2>
  <pre><code>    struct CarsView: View {
          @ObservedObject var carViewModel:CarViewModel
          @State private var carInfoIsPresented = false
          
          var body: some View {
              
              NavigationView{
                  VStack{
                      List {
                          ForEach(carViewModel.cars) { car in
                              HStack{
                                  VStack(alignment:.leading){
                                      Text(car.model ?? &quot;&quot;)
                                          .font(.title2)
                                      Text(car.make ?? &quot;&quot;)
                                          .foregroundColor(Color(UIColor.systemGray))
                                  }
                                  NavigationLink(destination: ServicesView(carViewModel: carViewModel, selectedCar: car)){
                                      Spacer()
                                      Text(&quot;Services&quot;)
                                          .frame(width: 55)
                                          .font(.caption)
                                          .foregroundColor(Color.systemGray)
                                  }
                              }
                          }
                      }
                      .listStyle(GroupedListStyle())
                      .navigationBarTitle(&quot;Cars&quot;)
                      .accentColor(.white)
                      .padding(.top, 20)
                  }  
              }
          }
      }
  </code></pre>
  <h2>ServicesView</h2>
  <pre><code>    struct ServicesView: View {
          @ObservedObject var carViewModel: CarViewModel
          var selectedCar: Car
          
          // ISSUE: No issues dismissing the RecordsView if I comment this out
          @AppStorage(&quot;sortByNameKey&quot;) private var sortByName = true
  
          @State private var selectedService: CarService?
  
          var body: some View {
              VStack{
                  List {
                      ForEach(carViewModel.carServices) { service in
                          HStack{
                              Text(service.name ?? &quot;&quot;)
                                  .font(.title3)
                              
                              NavigationLink(destination: ServiceInfoView(carViewModel: carViewModel, selectedCar: selectedCar, selectedService: service)){
                                  Spacer()
                                  Text(&quot;Details&quot;)
                                      .font(.caption)
                                      .foregroundColor(Color.systemGray)
                              }
                          }
                      }
                  }
                  .navigationBarTitle(Text(&quot;\(selectedCar.model ?? &quot;Services&quot;) - Services&quot;))
                  .listStyle(GroupedListStyle())
              }
              .onAppear{
                  carViewModel.getServices(forCar: selectedCar)
              }
          }
      }
  </code></pre>
  <h2>ServiceInfoView</h2>
  <pre><code>    struct ServiceInfoView: View {
          @ObservedObject var carViewModel: CarViewModel
          @State private var recordsViewIsPresented = false
          @State var selectedCar: Car
          @State var selectedService: CarService
          
          var body: some View {
              VStack{
                  Text(selectedService.name ?? &quot;&quot;)
                      .font(.largeTitle)
                      .padding(.bottom)
                  
                  VStack{
                      Button(action: openRecordsView) {
                          Text(&quot;Service History&quot;)
                      }
                      .padding(10)
                      .background(Color.blue)
                      .foregroundColor(Color.white)
                      .cornerRadius(15)
                  }
              }
              .sheet(isPresented: $recordsViewIsPresented){
                  RecordsView(carViewModel: carViewModel, selectedService: selectedService)
              }
          }
          
          func openRecordsView(){
              recordsViewIsPresented.toggle()
          }
      }
  </code></pre>
  <h2>RecordsView</h2>
  <pre><code>    struct RecordsView: View {
          @ObservedObject var carViewModel: CarViewModel
          @State var selectedService: CarService
          @Environment(\.presentationMode) var presentationMode
  
          var body: some View {
              NavigationView {
                  VStack{
                      List {
                          Section(header: Text(&quot;Records&quot;)) {
                              ForEach(carViewModel.serviceRecords) { record in
                                  HStack{
                                      Text(&quot;Service Date:&quot;)
                                      Text(&quot;\(record.serviceDate ?? Date(), style: .date)&quot;)
                                          .foregroundColor(Color(UIColor.systemGray))
                                  }
                              }
                          }
                      }
                      .background(Color.purple)
                      .listStyle(GroupedListStyle())
                  }
                  .navigationBarTitle(&quot;Records for \(selectedService.name ?? &quot;&quot;)&quot;, displayMode: .inline)
                  .navigationBarItems(leading: Button(&quot;Cancel&quot;, action: dismissView))
                  .onAppear{
                      carViewModel.getRecords(forService: selectedService)
                  }
              }
          }
          
          func dismissView(){
              presentationMode.wrappedValue.dismiss()
          }
      }
  </code></pre>