Did Apple really remove the ability to handle navigation with enums outside of List views in iOS 16?
In iOS 15 you used to be able to do something like they do in the Fruta sample SwiftUI app:
Define an enum which will hold which screen the user is currently in
enum NavigationItem {
case menu
case favorites
case recipes
}
And then add links in your app to modify the current screen enum, triggering a screen transition.
NavigationLink(tag: NavigationItem.menu, selection: $selection) {
SmoothieMenu()
} label: {
Label("Menu", systemImage: "list.bullet")
}
The problem is that migrating to iOS16 Swift now warns me with:
'init(tag:selection:destination:label:)' was deprecated in iOS 16.0: use NavigationLink(value:label:) inside a List within a NavigationStack or NavigationSplitView
Did Apple really decide to force us to chose between containing all our links inside Lists and not using enums to define the current screen? It seems overly restrictive for no reason and forces me to write some really ugly hacks to have stand-alone links that don't belong to a list.