Skip to content

Instantly share code, notes, and snippets.

@jaminguy
Created May 20, 2014 15:03
Show Gist options
  • Save jaminguy/2ca497affc41c4150dc5 to your computer and use it in GitHub Desktop.
Save jaminguy/2ca497affc41c4150dc5 to your computer and use it in GitHub Desktop.
Load a view from a nib in almost one line
+ (instancetype)newInstance {
id newInstance = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
return [newInstance isKindOfClass:[self class]] ? newInstance : nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment