【发布时间】:2019-12-08 13:55:38
【问题描述】:
我正在尝试在 SwiftUI 中实现 PresentationButton。我不断收到以下错误:
调用中的参数 #1 缺少参数 插入 ', '
我使用的是 Xcode 11.0 测试版。
这是我的 SwiftUI 文件:
import SwiftUI
struct HomeList : View {
var body: some View {
ScrollView(showsHorizontalIndicator: false) {
HStack {
ForEach(0 ..< 5/) { item in
PresentationButton(destination: ContentView()) {
CourseView()
}
}
}
}
}
}
#if DEBUG
struct HomeList_Previews : PreviewProvider {
static var previews: some View {
HomeList()
}
}
#endif
struct CourseView : View {
var body: some View {
return VStack(alignment: .leading) {
Text("Build an app with Swift UI")
.font(.title)
.fontWeight(.bold)
.color(Color.white)
.padding(20)
.lineLimit(4)
.frame(width: 120)
Spacer()
Image("Illustration1")
}
.background(Color("background3"))
.cornerRadius(30)
.frame(width: 246, height: 360)
.shadow(color: Color("backgroundShadow3"), radius: 20, x: 0, y: 20)
}
}
【问题讨论】:
-
您使用的是 beta 1?如果您想在这里获得帮助,您可能应该升级到最新版本(beta 5)。 很多已经改变。这一次,PresentationButton 已被弃用,不再可用。