davdroman / Bohr

Settings screen composing framework
MIT License
1.26k stars 83 forks source link

Set optional custom user defaults #41

Closed kevinwo closed 4 years ago

kevinwo commented 8 years ago

Allow the ability to set a custom NSUserDefaults object instead of using standard defaults (e.g. if an app extension wants to shared defaults using an app group, one might want to initialize an NSUserDefaults object with a custom suite identifier).

davdroman commented 8 years ago

I don't think wrapping NSUserDefaults in a BOSettings object is the way to go to achieve this. It'd be far better to implement this in some form of dependency injection (the dependency being an NSUserDefaults object in this case).

This is really worth discussing. Take a look at #32, where we talk about the need for Bohr to be completely persistence storage agnostic. And it's definitely worth considering for #33 as well.

I wonder if we could achieve this without breaking the current build and without the need to create a wrapper around NSUserDefaults. I bet we can.