store data in userdefaults in swift code example
Example 1: how to fmake sure that data is save in userdefault
if let appDomain = Bundle.main.bundleIdentifier {
UserDefaults.standard.removePersistentDomain(forName: appDomain)
}
Example 2: how to fmake sure that data is save in userdefault
let name = "John Doe"
UserDefaults.standard.set(name, forKey: "name")