5 // Created by Quang Anh Do on 03/07/2010.
6 // Copyright 2010 Quang Anh Do. All rights reserved.
12 @implementation Contact
14 @synthesize identifier;
15 @synthesize displayName;
20 [displayName release];
25 + (Contact *)contactWithDictionary:(NSDictionary *)dictionary {
26 Contact *contact = [[self alloc] init];
27 contact.identifier = [[dictionary objectForKey:@"id"] intValue];
28 contact.displayName = [dictionary objectForKey:@"displayName"];
30 return [contact autorelease];
34 #pragma mark Keyed Archiving
38 - (void) encodeWithCoder: (NSCoder *)encoder {
39 [encoder encodeInt: [self identifier] forKey: @"identifier"];
40 [encoder encodeObject: [self displayName] forKey: @"displayName"];
43 - (id) initWithCoder: (NSCoder *)decoder {
46 [self setIdentifier: [decoder decodeIntForKey: @"identifier"]];
47 [self setDisplayName: [decoder decodeObjectForKey: @"displayName"]];