title: SwiftUI - Trigger other actions when click NavigationLink
body: <p>I create a list view with a button in an up layer. I want to hide the button immediately right after user clicks the NavigationLink and doesn't see it in a detail view. </p>
  
  <p>I implement it successfully by using <code>@State var showAddButton</code> and control it by <code>onDisappear</code> and <code>onAppear</code> action like below, but the button won't disappear if the main view doesn't disappear completely. </p>
  
  <p>Does anyone have any other solution to trigger other actions and keep the original link action of NavigationLink?</p>
  
  <pre class="lang-swift prettyprint-override"><code>@State var showAddButton = true
  
      var body: some View {
  
          ZStack{
  
              NavigationView{
                  List{
                      ForEach(items, id: \.id){ item in
                          NavigationLink(destination: WorkItemDetailView(item: item)){
                              WorkItemListRow(item: item)
                          }.onDisappear{self.showAddButton = false}
                              .onAppear{self.showAddButton = true}
  
                      }
                  }
                  .navigationBarTitle("List", displayMode: .inline)   
              }           
  
              if showAddButton {
                  FloatAddButton()
              }
          }
      }
  </code></pre>