Why does SwiftUI throw errors when I try to use control flow?
问题 Why does SwiftUI like to throw errors like Closure containing control flow statement cannot be used with function builder 'ViewBuilder' When I simply try something like VStack { for i in 0...10 { Text("Hello, world!") } } It will not compile. Why does swift care? How does the SwiftUI framework even detect if there are control flow statements, and throw errors? 回答1: How does the SwiftUI framework even detect if there are control flow statements, and throw errors? It doesn't. The Swift language