sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.99k stars 119 forks source link

Adds `publisher` function, accepting array of keys #148

Closed leoMehlig closed 1 year ago

leoMehlig commented 1 year ago

In my app I have a use case, where I have a dynamic array of keys, which I want to observe using a Publisher (a publisher works better here then AsyncSequence). By giving an option to use either variadic parameters or an array, that would be possible without breaking any code.

Additionally, I've discovered a crash when observing multiple keys and immediately cancelling the publisher. Here an observer, which was not yet added, was removed. Added check to make sure, this can't happen.