I'm trying to make my iPhone apps (targeting iOS 15 and above) fully compatible with iOS 16 without success!
I don't know how to have NavigationView for iOS 15 and NavigationStack for iOS 16 in the same piece of code.
The code above isn't accepted by Xcode:
if #available(iOS 16, *) {
NavigationStack {
} else {
NavigationView {
}
From: SwiftUI NavigationView/Stack if available iOS 15/16
I guess that creating a custom container, as suggested by @timmy, will be the only solution. But I don't know how to proceed.
What's the solution then?