tags:

views:

68

answers:

2

It is possible to write the whole dictionary to a property list object, but I would like to make my application more efficient by only writing out the parts of the property list that have been modified.

Say I have a property list with several dictionaries under the root node. I would like to modify one dictionary and save it, but writing the entire property list (including the unmodified dictionaries) is unnecessary. Are there ways to get around this? thank you!

+1  A: 

If you are talking about writing the dictionary to a file, I don't think there is a way to get around saving the entire thing.

Changing one item could change the length of the file, which would change the positions of everything else in the file, so there would be no way to write only the changed items.

The only reason I could see for wanting to do this would be if you have an enormous file that changes often and takes a long time to write. If that is the case, perhaps you should split the property list up into smaller, more manageable sections that can be read and written individually.

e.James
+3  A: 

There is no way to do what you want. However, you should be aware that CoreFoundation has been highly optimized for reading/writing plist files. You should not even begin to worry about something like this until it shows up in profiling as a bottleneck.

Kevin Ballard