SwiftyUserDefaults icon indicating copy to clipboard operation
SwiftyUserDefaults copied to clipboard

Using this in extensions

Open crspybits opened this issue 4 years ago • 1 comments
trafficstars

I'd like to be able to save a value into user defaults with this library, and then retrieve the value in a sharing extension, or vice versa. E.g., see https://stackoverflow.com/questions/45607903/sharing-userdefaults-between-extensions

It looks like this isn't supported yet for this library. Any plans? Thanks!!

(I use your package here: https://github.com/crspybits/PersistentValue.git).

crspybits avatar May 16 '21 23:05 crspybits

@crspybits this IS supported. DefaultsAdapter has constructor which takes UserDefaults instance. You need to create to create UserDefaults with appropriate app group shared between your main app and app extensions.

ky1vstar avatar May 31 '21 09:05 ky1vstar