swift - 如何解决swiftUI中的“使用未解析的标识符'PresentationLink'”错误?
问题描述
在 swiftUI 中,我尝试创建 PresentationLink 按钮,但在 beta 5 中更新 xcode 后,出现“使用未解析的标识符 'PresentationLink'”错误。我不知道为什么。
'PresentationLink' 它已被弃用,是否已被其他名称取代?我在文档中没有找到。
我的代码:
import SwiftUI
struct NavBar : View {
var body: some View {
VStack {
Image("navigation_border")
.resizable()
.aspectRatio(contentMode: .fill)
HStack {
Spacer()
// Compass button
Button(action: {
// Code here
}) {
Image("ic_compass")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: CGFloat(35), height: CGFloat(35), alignment: .center)
Text("Boussole")
.foregroundColor(Color("TextLight"))
.font(.system(size: 14))
.fixedSize()
}
.frame(height: CGFloat(50), alignment: .bottomLeading)
Spacer()
// Travel button
Button(action: {
// Code here
}) {
Image("ic_travel")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: CGFloat(35), height: CGFloat(35), alignment: .center)
Text("Parcours")
.foregroundColor(Color("TextLight"))
.font(.system(size: 14))
.fixedSize()
}
.frame(height: CGFloat(50), alignment: .bottomLeading)
Spacer()
// Settings button
PresentationLink(destination: Settings()) {
Image("ic_settings")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 32, height: 32, alignment: .center)
Text("Paramètres")
.foregroundColor(Color("TextLight"))
.font(.system(size: 14))
.fixedSize()
}
.frame(height: 50, alignment: .bottomLeading)
Spacer()
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 70, maxHeight: 70, alignment: .center)
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 90, maxHeight: 90, alignment: .center)
}
}
我做了 MacOS Catalina 的最新更新。
坦克你的帮助。
解决方案
推荐阅读
- python - 如何从两个相似的图像中提取噪声?
- ios - Yarn v2 和 Cocopods:node_modules 文件夹不存在
- android - 同一文件的不同 Uri
- mysql - MySQL 不允许写入文件系统
- c# - 如何将 PrivateKeyCiphertextBlob 或 PrivateKeyPlaintext 转换为字符串?
- assembly - “自修改链接”在 Pegasus 编程中是如何工作的?
- react-native - 反应导航 v 2x 将默认参数设置到屏幕中
- ios - 使用打开按钮从试飞中打开应用程序时在启动时崩溃
- matlab - 如何在 MATLAB 中使用点生成圆顶
- amazon-web-services - AWS ECS 容量提供商