I ran across something that I eventually figured out, but think that there\'s probably a much more efficient way to accomplish it.
I had an object (an NSObject which
If the properties had the same names as the keys used to access the dictionary then you could have just used KVC and had valueForKey:
instead of objectForKey
.
For example given this dictionary
NSDictionary *annotation = [[NSDictionary alloc] initWithObjectsAndKeys:
@"A title", @"title", nil];
and this Object
@interface MyAnnotation : NSObject
@property (nonatomic, copy) NSString *title;
@end
it wouldn't matter if I had an instance of the dictionary or MyAnnotation
I could call
[annotation valueForKey:@"title"];
Obviously that works the other way as well e.g.
[annotation setValue:@"A title" forKey:@"title"];