ios - 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()
}
)
}
}
}
任何帮助表示赞赏!
解决方案
您应该使用 Xcode 11 beta 3。您提到的组件名称是在 beta 2 之后更改的。
推荐阅读
- javascript - 检查值是否以某些方式匹配多个值的最佳方法是什么?
- c - 访问指针变量作为指向 C 中不同类型的指针
- java - Java 可运行接口解决方案
- javascript - 单击多个选择器的最后一个元素
- dart - 如何让 FAB 更宽
- wordpress - WP 终于上线了:如何即时编辑 style.css 并进行直播(主题编辑器?)并立即看到更改 + 缓存
- javascript - 获取与特定值匹配的 JSON 对象
- php - UPDATE 语句在执行时不起作用
- python - 如何在 python 中正确存储“用户制作”的对象?
- php - 带有 COUNT 和 ORDER BY 以及隐藏结果的 MySQL 查询