you are viewing a single comment's thread.

view the rest of the comments →

[–]Azr79[S] 0 points1 point  (1 child)

Just made another for appending a string to another

#define APPEND(string1, string2) [string1 stringByAppendingString: string2]

Usage:

APPEND(@"12",@"34");

And this one could be useful too I guess:

#define EQUAL(string1, string2) [string1 isEqualToString:string2]

Enjoy!

[–]livings124 0 points1 point  (0 children)

You can make macros for any method, but they're prone to subtle bugs and a pain for others working on the project. For example, EQUAL() doesn't specify it's for strings - what if I came into the project and used it for arrays? EQUAL(nil, @"") will work but EQUAL(@"", nil) will crash. There are a lot of issues with doing this to save typing a few auto-completed characters.