NavigationLink 和 PresentationLink 错误
NavigationLink and PresentationLink Error
我正在研究 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()
}
)
}
}
}
感谢任何帮助!
你应该使用 Xcode 11 beta 3。你提到的组件名称在 beta 2 之后被更改了。
我正在研究 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()
}
)
}
}
}
感谢任何帮助!
你应该使用 Xcode 11 beta 3。你提到的组件名称在 beta 2 之后被更改了。