Check out example codes for "swift clear user defaults". It will help you in understanding the concepts better.

Code Example 1

let domain = Bundle.main.bundleIdentifier!
UserDefaults.standard.removePersistentDomain(forName: domain)
UserDefaults.standard.synchronize()
print(Array(UserDefaults.standard.dictionaryRepresentation().keys).count)

Learn ReactJs, React Native from akashmittal.com