title: SwiftUI 2.0: Close button is not dismissing the view - how do I get the Close button to return to the previous view?
body: <p>I have tried to use Buttons and Navigation Links from various examples when researched on this channel and on the net.  The NavigationLink would be ok, except that the NavigationView is pushing everything down in my view.</p>
  <p>I have a view that contains an image and a text like this: ( x Close) but when I use the code below, the Close button is not doing anything.</p>
  <p>In <code>ContentView()</code> I have a (?) button that takes me from <code>WalkthroughView()</code>, then to the PageTabView, then to this view, TabDetailsView:</p>
  <p>ContentView():</p>
  <pre><code>ZStack {
          NavigationView {
              VStack {
                  Text(&quot;Hello World&quot;)
                      .padding()
                      .font(.title)
                      .background(Color.red)
                      .foregroundColor(.white)
              }
              .toolbar {
                  ToolbarItem(placement: .navigationBarLeading) {
                      Button {
                          withAnimation {
                              showOnBoarding = true
                          }
                      } label: {
                          Image(systemName: &quot;questionmark.circle.fill&quot;)
                      }
                  }
              }
          }
          .accentColor(.red)
          .disabled(showOnBoarding)
          .blur(radius: showOnBoarding ? 3.0 : 0)
          
          if showOnBoarding {
              WalkthroughView(isWalkthroughViewShowing: $isWalkthroughViewShowing)
          }
      }
      .onAppear {
          if !isWalkthroughViewShowing {
              DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                  withAnimation {
                      showOnBoarding.toggle()
                      isWalkthroughViewShowing = true
                  }
              }
          }
      }
  </code></pre>
  <p>WalkthroughView():</p>
  <pre><code>var body: some View {
      ZStack {
          GradientView()
          VStack {
              PageTabView(selection: $selection)
  
              // shows Previous/Next buttons only
              ButtonsView(selection: $selection) 
          }
      }
      .transition(.move(edge: .bottom))
  }
  </code></pre>
  <p>PageTabView():</p>
  <pre><code>var body: some View {
      TabView(selection: $selection) {
          ForEach(tabs.indices, id: \.self) { index in
              TabDetailsView(index: index)
          }
      }
      .tabViewStyle(PageTabViewStyle())
  }
  </code></pre>
  <p>below, is the TabDetailsView():</p>
  <p>At the top of the view is this Close button, when pressed, should send me back to ContentView, but nothing is happening.</p>
  <pre><code>struct TabDetailsView: View {
      @Environment(\.presentationMode) var presentationMode: Binding&lt;PresentationMode&gt;
      let index: Int
  </code></pre>
  <p>then, inside the body:</p>
  <pre><code>VStack(alignment: .leading) {
          Spacer()
          VStack(alignment: .leading) {
              // Button to close each walkthrough page...
              Button(action: {
                  self.presentationMode.wrappedValue.dismiss()
              }) {
                  Image(systemName: &quot;xmark.circle.fill&quot;)
                  Text(&quot;Close&quot;)
              }
              .padding(.leading)
              .font(.title2)
              .accentColor(.orange)
  
              Spacer()
              VStack {
                  Spacer()
                  Image(tabs[index].image)
                      .resizable()
                      .aspectRatio(contentMode: .fit)
                      .frame(width: 415)
                      .padding(.leading, 10)
                  
                  Text(tabs[index].title)
                      .font(.title)
                      .bold()
                  
                  Text(tabs[index].text)
                      .padding()
                  Spacer()
              }
              .foregroundColor(.white)
          }
      }
  </code></pre>