【发布时间】:2019-06-17 21:21:30
【问题描述】:
我正在尝试将目标视图结构传递给另一个视图,但代码无法编译。
我想传入一些符合视图协议的结构,所以它可以在导航按钮目的地中使用,但我似乎无法编译它。我也尝试将目标类型设置为 _View。任何建议都非常感谢。
struct AnimatingCard : View {
var title, subtitle : String
var color : Color
var destination : View
init(title : String, subtitle: String, color: Color, destination : View){
self.title = title
self.subtitle = subtitle
self.color = color
self.destination = destination
}
var body: some View {
NavigationButton(destination: destination) {
...
}
}
}
【问题讨论】: