【发布时间】:2020-11-17 10:57:15
【问题描述】:
今年早些时候,我使用 SwiftUI 创建了一个应用程序。在 iOS 14 中运行时,此应用程序的一部分损坏了。我有一个创建和编辑表单,目标是重用它们共有的部分。以前它可以将这些部分放在 Group 中,因为 iOS 14 失败并将所有部分放在一个视图中。
目前的实现类似于这样:
struct CreateForm: View {
var body: some View {
Form {
Section {
Text("First section")
}
OtherSections()
}
}
}
struct OtherSections: View {
var body: some View {
Group { // <--- This is causing the issue
Section {
Text("First Detail Section")
}
// In real implementation there are some conditional sections
if false {
Section {
Text("Second Detail Section")
}
}
}
}
}
关于如何解决这个问题的任何建议?
【问题讨论】: