'SwiftUI view builder difference in ios13 and ios15
Just started learning SwiftUI and reading a book, written around mid 2020 using iOS13, which says a conditional view needs to wrapped inside a view builder otherwise it won't compile because SwiftUI won't know what type of the view is. For example, it says the following won't compile but I just tried in Xcode 13, iOS15 and it compiles fine. So has view builder been updated since iOS13?
struct TestView: View {
@Binding var n: Int
var body: some View {
if n > 0 {
Text("Tapped \(n) times.")
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
