title: SwiftUI - TabView Overlay with custom view
body: <p>in my last <a href="https://stackoverflow.com/questions/65003961/swiftui-overlay-tabview-with-custom-view">question</a> I've asked about a method to achieve the following TabView overlay in SwiftUI:</p>
  <p><a href="https://i.stack.imgur.com/cZQ52.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cZQ52.gif" alt="TabView Overlay" /></a></p>
  <p>Thanks again @davidev for the quick support.</p>
  <p>I modified the solution with an opportunity to apply conditional view modifier. In this case .overlay().</p>
  <pre><code>extension View {
      @ViewBuilder
      func `if`&lt;Content: View&gt;(_ condition: Bool, content: (Self) -&gt; Content) -&gt; some View {
          if condition {
              content(self)
          }
          else {
              self
          }
      }
  }
  </code></pre>
  <p>The code snipped above empowered me to implement the conditional toolbar to appear when an observedObject is toggled (e.g. by a switch from read to edit mode):</p>
  <pre><code>.if(class.observedObject){ view in
      view.overlay(ToolbarFromDavidev())
  }
  </code></pre>
  <p>This also works but it's really buggy (e.g. the whole view navigation gets reset and I've limited styling opportunities).</p>
  <p>This leads me to my question: Does someone of you have a reference implementation which I can use for my orientation? I would like to solve this with a ZStack that I can position over my TabView that I use for navigation. Like it's shown in the GIF above. However, I'm not able to position the ZStack over the TabView. Already tried stuff like ignoring safe areas etc.</p>
  <p>Many Thanks!</p>