removeObject(forKey:)
Removes the value for the specified key from the defaults database.
Declaration
func removeObject(forKey defaultName: String)Parameters
- defaultName:
The key with the value you want to remove.
Discussion
This method removes the specified key and value from the app-specific settings. If your UserDefaults object writes to settings for an app group or other shared settings file, the method removes the key from that file instead. This method removes the key and value only from the target domain, and doesn’t impact values for the same key in other domains. For example, it doesn’t remove keys and values from the global domain.
After you remove the key, the system generates a didChangeNotification for registered observers.