NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Ultimate Portfolio App - How to replace the deprecated "init(destination:tag:selection:label:)" in video 37 "Integrating with spotlight"?

Forums > SwiftUI

Hi everyone,

I encountered an error at the part of the video where Paul adds this code :

if let item = viewModel.selectedItem {
        destination: EditItemView(item: item),
        tag: item,
        selection: $viewModel.selectedItem,
        label: EmptyView.init

It says it's been deprecated and also says how to replace it, but I don't understand. Can someone help me replace it using the new Xcode 14.1 API please?

Thank you in advance!


Having this issue as well. Using NavigationLink(value: , label: ) does not give me the result I'm looking for.


I found this works

  @State var selection: String = "Overview"
    @State private var columnVisibility = NavigationSplitViewVisibility.doubleColumn

    var body: some View {

        NavigationSplitView(columnVisibility: $columnVisibility) {

                List(selection: $selection) {
                    Section("Installer Section")
                        NavigationLink( value: "Overview")
                            Label("Overview" , systemImage: "")
                        NavigationLink( value: "Welcome")
                            Label("Welcome" , systemImage: "")
                        NavigationLink( value: "Contents")
                            Label("Contents" , systemImage: "")
                        NavigationLink( value: "Thanks")
                            Label("Thanks" , systemImage: "")
                    NavigationLink( value: "Settings")
                        Label("Settings" , systemImage: "gear")

        } detail: {

            if selection == "Overview" {
            } else if selection == "Welcome" {
            }else if selection == "Contents" {
            }else if selection == "Thanks" {
            }else if selection == "Settings" {

        .navigationSplitViewColumnWidth(min: 150, ideal: 250, max: .none)


Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.