Re: Understanding user defaults
Re: Understanding user defaults
- Subject: Re: Understanding user defaults
- From: Graham Cox <email@hidden>
- Date: Tue, 19 Mar 2013 10:29:16 +1100
On 19/03/2013, at 10:21 AM, Rick Mann <email@hidden> wrote:
> t seems like an NSArchiver subclass could call -encodeWithCoder: to create a dictionary that could live in a plist file (as opposed to creating an NSData), and it could easily be used transparently. The advantage to this is twofold: you avoid a couple extra lines in your code each time you access the pref, and the prefs plist is human-readable.
You still have to ensure that the dictionary only contains valid property list objects though, which limits you to fairly fundamental types. In most cases it would probably work, but you still need to be aware of it in your encodeWithCoder method.
For example, a NSColor is a typical object that you might want to save in prefs, but isn't a property list object. One way or another it has to be encoded in some other form.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden