swift - How do I reset all global variables? -


i want reset global variables when user logs out otherwise of information stay (the info in global variables).

is there way without manually resetting them initial value when log out button pressed?

if understand correctly, saving user-data global variable? doesn't seem make sense me.

if intending equal nsuserdefaults global variables, can use following approach delete data standard userdefaults:

private func cleanuserdefaultsonlogout() {     let standarddefaults = userdefaults.standard     key in standarddefaults.dictionaryrepresentation().keys {         standarddefaults.removeobject(forkey: key)     }     standarddefaults.synchronize() } 

please correct me if i've misinterpreted question.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -