SwiftiSwift
SwiftiSwift

Reputation: 8767

Can't click a NavigationLink in List (SwiftUI)

I can't click on a NavigationLink in a List after the Xcode update to Beta 3. The row is gray for some reason.

enter image description here

Here's the code:

List {
        Section {

            NavigationLink(destination: Text("ProfileView")) {
                Text("Profil")
            }

            NavigationLink(destination: Text("Einstellungen")) {
                Text("Einstellungen und Datenschutz")
            }
        }
    }

Upvotes: 4

Views: 3262

Answers (2)

iGatiTech
iGatiTech

Reputation: 2268

List should be inside NavigationView,

Update your code as mentioned below,

NavigationView {
    List {
        Section {

            NavigationLink(destination: Text("ProfileView")) {
                Text("Profil")
            }

            NavigationLink(destination: Text("Einstellungen")) {
                Text("Einstellungen und Datenschutz")
            }
        }
    }
}

Upvotes: 7

iicaptain
iicaptain

Reputation: 1195

Make sure your NavigationLink is inside a NavigationView

Upvotes: 3

Related Questions