Re: NSUserDefaults and custom classes
Re: NSUserDefaults and custom classes
- Subject: Re: NSUserDefaults and custom classes
- From: Mike Abdullah <email@hidden>
- Date: Sun, 15 Jul 2007 14:53:25 +0100
Personally, I would implement the NSArchiver methods in your class
and then simply write a NSData representation of the object into the
defaults using that. This is how we store NSColor etc. at the moment.
It's particularly handy from a binding's perspective since you can
bind to the shared user defaults and then have the standard value
transformer unarchive the data.
Mike.
On 15 Jul 2007, at 13:35, Devraj Mukherjee wrote:
Hi everyone,
To store user defaults I have created an object that contains strings
and numbers as instances variables. I plan to write this object to the
as a user defaults object.
From a design perspective, should I have another class write and read
this object to the user defaults or is it OK to have the object write
and read itself from the user defaults space.
The class interface looks like
@interface MyCustomDefaults : NSObject {
NSString * userName;
NSString * password;
NSString * hostName;
NSNumber * port;
}
- (id) init;
- (id) initFromUserDefaults;
- (void) writeAsUserDefaults;
Thanks for your time.
--
"I never look back darling, it distracts from the now", Edna Mode (The
Incredibles)
_______________________________________________
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:
40mikeabdullah.net
This email sent to email@hidden
_______________________________________________
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