这是我的代码
struct Home: View {
@State var status = UserDefaults.standard.value(forKey: "status") as? Bool ?? false
var userEmail = Auth.auth().currentUser?.email
@State private var hasTimeElapsed = false
var body: some View {
if self.status {
while (idkisrun == true) {
if group_array.contains(userEmail ?? "1") {
HomeScreen()
} else {
Verify()
}
}
} else {
VStack{
Login()
}
这是错误
error: closure containing control flow statement cannot be used with result builder 'ViewBuilder'
while (idkisrun == false) {
^
SwiftUI.ViewBuilder:2:30: note: struct 'ViewBuilder' declared here
@resultBuilder public struct ViewBuilder {
我该如何解决这个问题才能等待变量为真,然后从那里继续代码?