Sample project for SwiftUI NavigationSplitView on Github
Note: Last year activity slowed down a bit on both this blog and the BeerDiary app but I’m trying to pick up the pace again.
The main feature for the next release of BeerDiary will be support for iPad (and maybe, using Catalyst, also macOS). The current app is based on NavigationStack and NavigationLink but on iPad I want to use a two or even three column view.
So I tried converting the app to NavigationView and it was pretty quick and it worked reasonably well. There is only one downside: it is deprecated.
So I ended up refactoring to the newer NavigationSplitView that became available in iOS 16. The problem however was that my NavigationLink
is quite deep down in the view hierarchy so fitting NavigationSplitView
to the app became quite a bit refactor.
To help with this and prototype solutions easily, I made a small test project that can be found here. It has sample code for 2 and 3 column views and supports edit
mode and some other nice things. I could not easily find sample code that combined all these things so hopefully it can be useful to you.
If you have feedback, please send me a message or open a PR!