Re: variable indirection
Re: variable indirection
- Subject: Re: variable indirection
- From: Alastair Houghton <email@hidden>
- Date: Sun, 23 Dec 2007 14:07:51 +0000
On 22 Dec 2007, at 23:36, Paul Phillips wrote:
From interface builder, this works fine if I bind to the name of the
property: e.g. "First" for first name or "Last" for last. However,
the
address book framework goes to some lengths to hide those string
literals, and only advertises string constants such as
kABFirstNameProperty and of course kABLastNameProperty. So I would
like
to bind to those variable names as they are presumably more stable
(and
perhaps more localizable.)
Those are keys, and therefore won’t be localized (you would never want
to localize a key; you’d just make your application work badly
whenever the user changed their language setting).
It’s very unlikely that Apple will ever change their values, which,
although not documented, are likely to be encoded in data stored on
disk or transmitted over the network.
If you’re really concerned, you could always use an NSDictionary to
map from your own custom keys to the ones defined by the AddressBook
framework. Personally I don’t think I’d bother, because the risk of
these constants changing their values seems extremely small (though
you’re right to consider the issue, because it certainly isn’t zero).
Moreover, doing that won’t work for newly defined keys that your
application doesn’t know yet (and I think the risk of that is much
greater).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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