NavigationLink 和 PresentationLink 错误

Posted

技术标签:

【中文标题】NavigationLink 和 PresentationLink 错误【英文标题】:NavigationLink and PresentationLink Error 【发布时间】:2019-07-05 10:34:42 【问题描述】:

我正在编写 Apple 网站上的 SwiftUI 教程。

从this 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()
                    
            )
        
    

感谢任何帮助!

【问题讨论】:

【参考方案1】:

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

【讨论】:

以上是关于NavigationLink 和 PresentationLink 错误的主要内容,如果未能解决你的问题,请参考以下文章