Search code examples
swiftuinavigationviewtabview

SwiftUI TabView in NavigationView hierarchical stack has extra space at the top of the screen


I have a flow of user registration. Where Welcome screen wrapped in NavigationView and then after several screens NavigationLink opens TabView. As I understand, as a result, TabView is in this navigation stack and has an extra space at the top of the screen. How to avoid this situation? I've tried this solution: https://stackoverflow.com/a/57332701/9325884 But it works only if you have one aka Login screen. So, I'm looking for a solution how to switch between two Navigation stacks. TIA


Solution

  • I found a solution in this article - link here and used @EnvironmentObject to manage what screen to show for my user depending on state