Home > Software design >  My init in viewModel calls print function three times
My init in viewModel calls print function three times

Time:11-29

I made a registration and login system with firebase. What is problem, when I click signout LoginViewModel call print function three times.

This is my code for LoginView:

struct LoginView: View {
    @State private var email: String = ""
    @State private var password: String = ""
    @State private var isSheet: Bool = false
    

    @ObservedObject var vm = LoginViewModel()
    
    var body: some View {
    
            if vm.userStatus == true {
                HomeView()
            } else {
            ScrollView{
                NavigationLink(destination: HomeView().navigationTitle("").navigationBarHidden(true),
                               isActive: $vm.userStatus)
                {EmptyView()}
                VStack(spacing:35){
                    Text("           
  • Related