【发布时间】:2020-03-31 20:58:10
【问题描述】:
我正在尝试从一个 SwiftUI 视图转到另一个 SwiftUI 视图,并且我正在按照下面的代码使用 NavigationLink,但我收到了错误:无法调用类型为 'NavigationLink<_ _> 的初始化程序' 带有类型为 '(destination: PlaylistTable)' 的参数列表
下面是触发链接到下一个视图的按钮的代码:
struct MusicButton: View {
var body: some View {
NavigationView {
Button(action: {
NavigationLink(destination: PlaylistTable())
})
{ Image(systemName: "music.note.list")
.resizable()
.foregroundColor(Color.white)
.frame(width: 25, height: 25, alignment: .center)
.aspectRatio(contentMode: .fit)
.font(Font.title.weight(.ultraLight))
}
}
}
}
【问题讨论】:
标签: swiftui swiftui-navigationlink