Google News
logo
IOS - Interview Questions
How to remove data from UserDefaults?
To remove any value from the UserDefaults, the removeObject() method is used. Here, we want to remove the value for key userToken, we can write the following code.
UserDefaults.standard.removeObject(forKey : "userToken ")   
Advertisement