title: SwiftUI - Overlay TabView with Custom View
body: <p>I'm having an app with a tab bar navigation concept. For one view I'm currently trying to implement a tab bar overlay that you all know from the Photos App in iOS. It appears when you select images. See below:</p>
  <p><a href="https://i.stack.imgur.com/Ca0Zj.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ca0Zj.gif" alt="Tab Bar Overlay" /></a></p>
  <p>I tried to implement this behavior in the below code snippet but I have two doubts:</p>
  <ul>
  <li>is <code>.overlay()</code> the right way to do it? I wanted to combine it with a State and set it accordingly to enable / disable the overlay.</li>
  <li>if overlay is ok from a coding point of view, how would I align it to the bottom and take care of the sizing so that it exactly overlays the tab bar?</li>
  </ul>
  <pre><code>struct ContentView: View {
      var body: some View {
          TabView {
              
              NavigationView {
                  Text(&quot;First Nav Page&quot;)
              }
              .tabItem {
                  Image(systemName: &quot;house&quot;)
                  Text(&quot;Home&quot;)
                  
              }.tag(0)
              
              NavigationView {
                  Text(&quot;Second Nav Page&quot;)
              }
              .tabItem {
                  Image(systemName: &quot;gear&quot;)
                  Text(&quot;Settings&quot;)
              }.tag(1)
              
              Text(&quot;No Nav Page&quot;)
                  .tabItem{
                      Image(systemName: &quot;plus&quot;)
                      Text(&quot;Test&quot;)
                  }.tag(2)
              
          }.overlay(
              Rectangle()
                  .foregroundColor(.red)
                  .frame(width: 40, height: 40)
          )
      }
  }
  </code></pre>
  <p>Thanks!</p>