First of all, let me say that this is NOT a complaint, I just want to understand how does the register(defaults: []) method works.
I\'m using the UserDe
From the documentation for register(defaults:):
If there is no registration domain, one is created using the specified dictionary, and NSRegistrationDomain is added to the end of the search list.
The contents of the registration domain are not written to disk; you need to call this method each time your application starts.
What this means is that the registered defaults act as a fallback to the normal, user defaults that you are working with. The registered defaults do not overwrite or replace the standard user defaults.
When you attempt to lookup a key from UserDefaults.standard, if the key isn't there, then it is looked up in the registered defaults and that result (if any) is returned.
Once you set a value in UserDefaults.standard, of course it is that value that is returned for the key. If you remove the key from UserDefaults.standard then the registered default is used again.