Creating a Today widget and I am using UserDefaults(suiteName:)
to persist some data. In the main application I am using UserDefaults.standard()
. This can't be read (or can it?) by the extension which is why I use the suiteName:
constructor.
Data that user persist to UserDefaults.standard()
in the main app needs to be available in the extension.
At this time I am persisting to both so that the values can be shared
UserDefaults.standard().set:...forKey:...
UserDefaults(suiteName:...)().set:...forKey:...
...
Question is should I drop UserDefaults.standard()
all together and just use UserDefaults(suiteName:)
in my application, or is this bad practice and if so why?
Edit: I am using an App group container. For clarification I am asking should I just replace standard()
with suiteName:
throughout my project?