TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A clean and simple class to sync NSUserDefaults to iCloud.
[DDiCloudSync sharedSync]
and set a delegate to handle merging potentially conflicting data from local or from iCloud[DDiCloudSync start];
whenever something is about to be sync'd up, this method is called to provide a final dictionary to send
- (NSDictionary*)mergedDefaultsForUpdatingCloud:(NSDictionary*)dictInCloud withLocalDefaults:(NSDictionary*)dict {
NSMutableDictionary *newdict = dict.mutableCopy;
newdict[@"merged"] = @"to icloud";
return newdict;
}
whenever something is about to be sync'd down, this method is called to provide a final dictionary to write to the defaults
- (NSDictionary*)mergedDefaultsForUpdatingLocalDefaults:(NSDictionary*)dict withCloud:(NSDictionary*)dictInCloud {
NSMutableDictionary *newdict = dict.mutableCopy;
newdict[@"merged"] = @"from icloud";
return newdict;
}
note: when you dont set a delegate, the class just overwrites the cloud / the local defaults