OSX/Cocoa window without XCode or Interface Builder
Nov 29, 2012 • Guilherme Lampert
So I wanted to programatically create a simple GUI application on Mac OS X, with a window and some
other simple UI components, just like I used to do on Windows using the WinAPI. Since I prefer command
line tools and coding, I also didn’t want to use XCode and the fancy Interface Builder (IB) tool that Apple provides.
Sounds very simple doesn’t it? Well, like people say, hell is in the details.
The actual amount of code required to do so is small, but the big issue was that
you just don’t find much official Apple documentation and examples on the subject!
Since I am also a beginner with Objective-C and Cocoa, it took me hours and hours of search
and research to finally be able to open a simple application window on the Mac.
The following Objective-C code listing is all it takes: