目前问题,首次点击后,弹窗有打开,但是弹窗里没有渲染内容,关闭后打开其它卡片可正常显示。。。
简化代码如下:
@State private var showStudentDetail: Bool = false
@State private var studentDetail: Student?
...
VStack(alignment: .leading, spacing: 12) {
ForEach(students) { student in
CardView(student: student)
.onTapGesture {
studentDetail = student
showStudentDetail.toggle()
}
}
.sheet(isPresented: $showStudentDetail) {
if let studentDetail = studentDetail {
StudentDetailView(student: studentDetail)
}
}
}