How to create a GUI application for Mac without using Xcode?
I found http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html but would like to know more details, like:
-
how to add an icon to it?
-
how to create a bundle?
-
what’s in a nib anyway and how to re-create its functionality via code?
-
what else is the example above missing from a similarly simple app created in Xcode?
In other words, where can I find out more on how a graphical application works and what does this “Xcode Cocoa application template”?
This is an extremely broad question, but I’ll point you in the right direction:
Icons are handled by adding an entry to info.plist, and copying an icon file in the application bunlde
A bundle is really just a directory with a specific set of files in it. Xcode handles this part of it for you, and you really should be using Xcode to do OSX development. You don’t have to use IB (I don’t), but not using Xcode at all is fairly pointless. It is designed to make your life easier in this realm.
A nib (or xib) file is simply a serialized file format that describes a bunch of Cocoa classes and how they should be “wired up” to each-other using bindings. Cocoa applications can read a nib file and use the information within it to instantiate complete user interfaces on the fly.
In general, there is no reason at all that you have to use IB. Apple’s documentation is full of examples on how to create
NSViewandNSControlobjects and subclasses, and how to lay them out on the screen. Note that this process will involve a lot of work on your end. You will have to learn how Cocoa handles windows and views, how it handles autoresizing, and how you can connect your model objects with those views in a meaningful way.