macOS SwiftUI Navigation for a Single View

Here is a simple demo of possible approach for custom navigation-like solution. Tested with Xcode 11.4 / macOS 10.15.4 Note: background colors are used for better visibility. struct ContentView: View { @State private var show = false var body: some View { VStack{ if !show { RootView(show: $show) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.blue) .transition(AnyTransition.move(edge: .leading)).animation(.default) … Read more

How to remove the default Navigation Bar space in SwiftUI NavigationView

For some reason, SwiftUI requires that you also set .navigationBarTitle for .navigationBarHidden to work properly. NavigationView { FileBrowserView(jsonFromCall: URLRetrieve(URLtoFetch: applicationDelegate.apiURL)) .navigationBarTitle(“”) .navigationBarHidden(true) } Update As @Peacemoon pointed out in the comments, the navigation bar remains hidden as you navigate deeper in the navigation stack, regardless of whether or not you set navigationBarHidden to false in … Read more

SwiftUI iOS14 – NavigationView + List – Won’t fill space

Problem It looks like the default styles of a List or NavigationView in iOS 14 may in some cases be different than in iOS 13. Solution #1 – explicit listStyle It’s no longer always the PlainListStyle (as in iOS 13) but sometimes the InsetGroupedListStyle as well. You need to explicitly specify the listStyle to PlainListStyle: … Read more