ios - How to user UserDefaults to Save Logged in state? -


i'm making introdution app, in swift 4 ran intro problem. have introcontroller , homecontroller view,root view introcontroller want if user logged in homecontroller introcontroll, whenever user open app, first view appear homcontroller, ( don't need login again ).

i think store login state inside of userdefaults, don't want app use navigation, idea? please help

thanks in advance

when make login save bool value this:

userdefaults.standard.set("1", forkey: "islogin") 

in appdelegate check login state this:

if userdefaults.standard.value(forkey: "islogin") != nil{             //navigate homeviewcontroller  }else{             //navigate rootviewcontroller  }  

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -