I just do a #define in the header like
#define kDictionayKey1 @"key1"
#define kDictionaryKey2 @"key2"
then use it somewhere in the .m file
foo = [myDic objectForKey:kDictionaryKey1];
and so on...
On Mar 8, 2012, at 6:29 PM, Prime Coderama wrote:
> I have references to 'ground' and 'air' in multiple files. It is usually used
> in this context, but not always.
>> if ([transport.type isEqualToString:@"ground"]) {
>> // do something for automobiles
>> }
>> else if ([transport.type isEqualToString:@"air"]) {
>> // do something else for planes
>> }
>> else {
>> // we don't care
>> }
>
> Should I be using string constants to represent 'ground' and 'air' so if I
> ever change their literal, I just update it in one place? e.g.
>> NSString * const TransportGround = @"ground";
>> NSString * const TransportAir = @"air";
>
> I then decide I want to rename 'ground' to be 'wheels', then I would only
> update the above string constant.
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/wsquires%40satx.rr.com
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]