UserDefaults.standard.set("value", forKey: "key") UserDefaults.standard.synchronize() let value = UserDefaults.standard.value(forKey: "value") print(value)