Skip to content
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 UserDefaultsMonitor #44

Closed
eBardX opened this issue Apr 23, 2018 · 5 comments
Closed

Add UserDefaultsMonitor #44

eBardX opened this issue Apr 23, 2018 · 5 comments
Assignees

Comments

@eBardX
Copy link
Owner

eBardX commented Apr 23, 2018

Feature Name

  • UserDefaultsMonitor -- should live in Foundation folder

Events

  • didChange(UserDefaults) -- wraps UserDefaults.didChangeNotification notification
  • sizeLimitExceeded -- wraps UserDefaults.sizeLimitExceededNotification notification

Platform

iOS/macOS/tvOS/watchOS

@Descartess Descartess self-assigned this Apr 24, 2018
@eBardX
Copy link
Owner Author

eBardX commented Apr 24, 2018

@Descartess
Note: didChange(UserDefaults) looks to be very straightforward. The notifications wrapped by the other four events have vague documentation. It is not clear to me how those notifications are even generated in normal usage.

@Descartess
Copy link
Collaborator

Descartess commented Apr 25, 2018

@eBardX I am wondering what is the notification object for the other four events besides didChange(UserDefaults)

@eBardX
Copy link
Owner Author

eBardX commented Apr 25, 2018

My guess is that it would be an instance of UserDefaults in all cases. But I have no empirical evidence to back that up (yet).

@eBardX
Copy link
Owner Author

eBardX commented May 13, 2018

@Descartess
I’m thinking it may sense to break this into two separate monitors: UserDefaultsMonitor and UbiquitousUserDefaultsMonitor. If you look at the Objective-C names of the notifications, you’ll find that 2 are prefixed with NSUserDefaults* and 3 are prefixed with NSUbiquitousUserDefaults*. Also note that only 1 notification is supported on macOS. No matter how you slice it, on macOS it makes no sense to have an options parameter. This will make for some ugly code, although perhaps slightly less ugly if we opt for 2 monitors instead of 1. What do you think?

@Descartess
Copy link
Collaborator

Yes, that is correct. Let me create a separate issue for that

@eBardX eBardX closed this as completed May 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants