This sample application (and test target) reproduces an issue with UserDefaults where:
- removing objects doesn't have effect
- removing persistentDomain doesn't have effect
The outcome of this investigation are the following rules:
-
If you use the
UserDefaults(suiteName:)
make sure that- the
suiteName
is in the reverse domain format - you have the
Host Applicaation
set
- the
-
If you do unit tests without
Host Application
- you have to mock UserDefaults