I have found that using NavigationView
can present problems on both iPhone and iPad apps running under iOS 16, even though NavigationView
is only deprecated for now. On an iPhone, views reached from a NavigationLink
often close themselves as soon as they are opened. On an iPad, the same problem occurs and the generation of Back arrows appears to be a bit random, especially in document apps. I have found it well worth making the effort to use NavigationSplitView
and NavigationStack
, even though this has involved me writing quite a lot of extra code to achieve pleasing results, particularly in apps designed to run at their best on both iPhone and iPad. That said, Apple do provide some clear advice on how to adopt the new Views here.
I have come across another oddity with iOS 16. Pickers in modal sheets, which have their list arrays populated .onAppear
, no longer work as intended and the Picker selection can no longer be set programmatically. You have to populate the Picker's list before activating the modal sheet and pass it to the Sheet as a Binding
.
Thanks halo for a top tip on how to use if #available()
.
NavigationView
seems to work fine on iOS 16 but I guess it will be, soon or later, obsoleted so I would prefer to be ready. I'm just wondering something: where should I place this piece of code? On one View.swift file and use it everywhere OR on every View.swift files before the main struct? Thanks again! – Presswork