daveremba Messages: 32 Registered: June 2011 Location: Los Angeles, CA, USA
Member
Here is the minimal app from the Xcode template
for a Cocoa MacOS application:
// this code creates a top level window, and draws whatever is in the nib file
// if there is no nib file, the app will draw nothing and no top window appears
// Xcode template puts this code into three files, but they can be merged into one .m file:
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
@interface cocoa_test2AppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
@end
@implementation cocoa_test2AppDelegate
@synthesize window;
// The @synthesize directive automatically generates the setters and getters
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
@end
and this file must exist:
cocoa_test2_bundle.app/Contents/Resources/English.lproj/MainMenu.nib