Skip to content

Instantly share code, notes, and snippets.

@chajka
Created May 11, 2013 04:30
Show Gist options
  • Save chajka/5558898 to your computer and use it in GitHub Desktop.
Save chajka/5558898 to your computer and use it in GitHub Desktop.
役に立たない奇妙なTips ref: http://qiita.com/items/9ab9f315f935820e5c53
nullObject : (null)
id nullObject = [[nil alloc] init];
NSLog("%@", nullObject);
Class klass = nil;
switch (condition) {
case a:
klass = [MyClass1 class];
break;
case b:
klass = [MyClass2 class];
break;
default:
klass = nil; // なくても良い
break;
}// end case by condition
id instance = [[klass alloc] init];
// 以下適切な処理を
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment