sdarlington / SDCloudUserDefaults

Store NSUserDefaults and iCloud data at the same time.
Apache License 2.0
108 stars 17 forks source link

Feature request: Notification when new data came from iCloud #5

Closed artemyarulin closed 10 years ago

artemyarulin commented 10 years ago

Hi there,

Thanks for the good library. I have a special case when I need to do some processing when new data came from the iCloud. What do you think about firing new notification here SDCloudUserDefaults.m#L140, like:

[[NSNotificationCenter defaultCenter] postNotificationName:SDCLOUD_NOTIFICATION_KEY_UPDATED
                                                    object:self
                                                  userInfo:@{key:obj}];

I can create a pull request for that if you wish. Thanks!

sdarlington commented 10 years ago

Any reason why you can't just subscribe to NSUbiquitousKeyValueStoreDidChangeExternallyNotification directly?

artemyarulin commented 10 years ago

Well, in short your library is a perfect additional abstraction for iCloud, I don't know how it works, I don't want to think about error processing, hell I have no idea what is NSUbiquitousKeyValueStoreChangeReasonKey.

My case is simple as "notify me when new data came from iCloud". Subscribing to NSUbiquitousKeyValueStoreDidChangeExternallyNotification direclty:

In real world I know that I can implement this in 10 minutes, it is not big deal, but it is not... elegant.

sdarlington commented 10 years ago

That's fair. And it would be completely benign for people who don't care.

I would welcome a pull request. Otherwise I'll look to add this when I get the chance.