Skip to content

Instantly share code, notes, and snippets.

@pcperini
Created May 29, 2012 18:41
Show Gist options
  • Save pcperini/2829951 to your computer and use it in GitHub Desktop.
Save pcperini/2829951 to your computer and use it in GitHub Desktop.
Quick (NS|UI)ViewController Loading
// .h
#if !TARGET_OS_IPHONE
#import <Cocoa/Cocoa.h>
#define APPLViewController NSViewController
#else
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#define APPLViewController UIViewController
#endif
@interface APPLViewController (QuickNibLoading)
- (id)initWithNib;
@end
// .m
@implementation APPLViewController (QuickNibLoading)
- (id)initWithNib
{
self = [self initWithNibName: NSStringFromClass([self class]) bundle: nil];
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment