Skip to content

Instantly share code, notes, and snippets.

@stevestreza
Created April 17, 2011 16:42
Show Gist options
  • Save stevestreza/924200 to your computer and use it in GitHub Desktop.
Save stevestreza/924200 to your computer and use it in GitHub Desktop.
Some convenience macros for common types of objects in ObjC
#define MWDict(...) ((NSDictionary *)[NSDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil])
#define MWArray(...) ((NSArray *)[NSArray arrayWithObjects:__VA_ARGS__, nil])
#define MWSet(...) ((NSSet *)[NSSet setWithObjects:__VA_ARGS__, nil])
#define MWURL(str, ...) ((NSURL *)[NSURL URLWithString:[NSString stringWithFormat:(str), ##__VA_ARGS__]])
#define MWString(str, ...) ((NSString *)[NSString stringWithFormat:(str), ##__VA_ARGS__])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment