首页 > 解决方案 > NavigationLink 和 PresentationLink 错误

问题描述

我正在研究 Apple 网站上的 SwiftUI 教程。

从这个url实现了演示。

它为 NavigationLink 和 PresentationLink 引发错误。

下面是我的正文段代码,

var body: some View {
        NavigationView {
            List {

                FeaturedLandmarks(landmarks: featured)
                    .scaledToFill()
                    .frame(height: 200)
                    .clipped()
                .listRowInsets(EdgeInsets())
                ForEach(categories.keys.sorted().identified(by: \.self)) { key in
                    CategoryRow(categoryName: key, items: self.categories[key]!)

                }
                .listRowInsets(EdgeInsets())
                NavigationLink(destination: LandmarkList()) {
                    Text("See All")
                }
                }
            .navigationBarTitle(Text("Featured"))
                .navigationBarItems(trailing:
                    PresentationLink(destination: Text("User Profile")) {
                        Image(systemName: "person.crop.circle")
                            .imageScale(.large)
                            .accessibility(label: Text("User Profile"))
                            .padding()
                    }
            )
        }
    }
}

在此处输入图像描述 在此处输入图像描述

任何帮助表示赞赏!

标签: iosswiftui

解决方案


您应该使用 Xcode 11 beta 3。您提到的组件名称是在 beta 2 之后更改的。


推荐阅读