-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add variadic generics version of Defaults.updates()
#191
Conversation
} | ||
|
||
for key in repeat (each keys) { | ||
let observation = DefaultsObservation(object: key.suite, key: key.name) { _, _ in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'm intentionally not using CompositeDefaultsObservation for simplicity, as it's not really needed here.
d294cfb
to
de47a2a
Compare
de47a2a
to
1637cf4
Compare
1637cf4
to
39c3496
Compare
let immutableObservations = observations | ||
|
||
continuation.onTermination = { _ in | ||
// `invalidate()` should be thread-safe, but it is not in practice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious about this. I thought that invalidate()
would be thread-safe with Lock
,
Should we use DispatchQueue.sync
instead inside the DefaultsObservation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure. I have seen KVO crashes in some of my apps that may have been caused by some threading problems in macOS. I prefer to keep it limited to this code until I can 100% confirm it. This is just a precaution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Thanks for the explanation!
No description provided.