// // ContentView.swift // sdsz74 // // Created by yunli on 2023/5/18. // import SwiftUI struct ContentView: View { @State private var examCount = 0 @State private var messageCount = 0 @State private var isLoggedIn = 0 var body: some View { TabView{ NavigationView { NavigationLink(destination: examListView(count:$examCount)) { Text("共 \(examCount) 场考试") } .navigationBarTitle("74 桌") } .tabItem({Image(systemName: "chart.bar.fill") Text("成绩分析")}) NavigationView { List{ NavigationLink(destination: messageView(count:$messageCount)) { Text("消息") .badge(messageCount) } } .navigationBarTitle("数字校园") } .tabItem({Image(systemName: "graduationcap") Text("数字校园")}) NavigationView{ if isLoggedIn != 0{ accountView(isLoggedIn: $isLoggedIn) .navigationBarTitle("账号") } else{ loginView(isLoggedIn:$isLoggedIn) .navigationBarTitle("登录") } } .tabItem({Image(systemName: "person") Text("账号")}) } } } extension View { func hideKeyboard() { UIApplication.shared.sendAction( #selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil ) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }