Skip to content

SwiftUI Navigation Example using iPadOS 15/macOS 11

License

Notifications You must be signed in to change notification settings

peteallport/SwiftUI-Navigation-Example

Repository files navigation

SwiftUI Navigation Example

  • This is a SwiftUI Navigation Example supporting iPadOS 15+/macOS 11+.
  • It uses only one NavigationView() and multiple NavigationLink()s without using (value: P?).
  • For iOS I recommend alternative hierarchical setup, like using TabView()

macOS

Screenshot 2022-11-25 at 6 58 44 PM

iPadOS

IMG_EFB40D56081E-1

Why?

  • This avoids more recent deployment targets such as iOS 16 or MacOS 13. Apple suggests using NavigationStack() or NavigationSplitView() to achieve more intricate views in their documentation but this may be prohibitive.

  • This project details the need for many ToolbarItem uses in order to display all of this correctly in the navigation bar.

  • This project further illustrates the need to have a "dummy" top-level view so when initialized the MacOS navigation toolbar() items are displayed correctly and continue to do so for child views.