People starting out with SwiftUI development may get a message like the following from Xcode when building their project:
`init(destination:isActive:label:)’ was deprecated in iOS 16.0: use NavigationLink(value:label:) inside a NavigationStack or NavigationSplitView
‘init(destination:tag:selection????️ )’ was deprecated in iOS 16.0: use NavigationLink(value????️ ), or navigationDestination(isPresented:destination:), inside a NavigationStack or NavigationSplitView
Why are you getting this message?
You are getting this message because you are using
NavigationView in your user interface.
The original version of SwiftUI used navigation views to navigate from one screen to another in an app and for master-detail interfaces with split views on iPad. In iOS 16 Apple replaced
NavigationSplitView for navigation.
The message is telling you to replace
NavigationView in your app with either
NavigationSplitView don’t run on earlier iOS versions. If you want your SwiftUI app to run on iOS 15, you must use
Is the message a problem?
Not currently. The message is a compiler warning, not an error. Your project will build and run, assuming there are no errors in the rest of your code.
Eventually Apple will stop supporting iOS 15. A future version of Xcode will drop support for building an app that runs on iOS 15. For reference Xcode 14 does not support iOS versions older than iOS 11. When Apple releases a version of Xcode that does not support building an app that runs on iOS 15, the message will be a problem.
How do you remove the message?
NavigationSplitView instead of
NavigationView in your app. Apple provides the following guide to migrate code from
If you are following a tutorial that uses
NavigationView, find a more recent tutorial that uses the newer navigation APIs.