4

The application I'm building consists of multiple views I need to navigate between. NavigationView is great, but my App targets MacOS 11 and there is no single content view navigation style (I basically want to display a single view at a time, nothing more).

I've written a custom view to do this but it can't utilise NavigationLink and all the other helpers (or.. can it?)

Implementing a custom NavigationViewStyle should work, but I can't figure it out from the Protocol. Apples documentation doesn't really help.

This actually displays a single view but navigation either does not seem to work or just does not trigger a view update. What am I missing ?

struct SingleContentNavigationViewStyle : NavigationViewStyle {
    func _body(configuration: _NavigationViewStyleConfiguration) -> _NavigationViewStyleConfiguration.Content {
        configuration.content
    }

    typealias _Body = _NavigationViewStyleConfiguration.Content
}
MwcsMac
  • 6,810
  • 5
  • 32
  • 52
JaggerJo
  • 734
  • 4
  • 15

0 Answers0