In SwiftUI there\'s frequently a need to display an \"empty\" view based on some condition, e.g.:
struct OptionalText:
You have to return something. If there is some condition where you want to display nothing, "display" an...EmptyView
;)
var body: some View {
Group {
if text != nil {
Text(text!)
} else {
EmptyView()
}
}
}
The SwiftUI DSL will require you to wrap the if/else in a Group
and the DSL has no guard/if let nomenclature.