简体   繁体   中英

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.

在此处输入图片说明

Here's the code:

List {
        Section {

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

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

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")
            }
        }
    }
}

确保您的NavigationLinkNavigationView内部

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM