It's been about 18 months since I switched to using Macs... and I feel quite guilty that I haven't taken the time to learn how to program using Objective C and Cocoa within the Xcode development environment. Well, with the iPhone SDK being released and international signups now being accepted, I decided it was time to give it a go. I've ordered two books, one on Objective C
and the other on Cocoa
(both sadly not immediately available). Due to the lack of availability, I decided to scour the web for tutorials and found two superbly illustrated (but lacking in in-depth detail) tutorials. Again, one for Objective C
and one for Cocoa
. These tutorials are okay if you grasp the basic concepts of C and Object Oriented programming, but will lead you into a false sense of security if you don't know of these concepts. Finally, another tutorial I found to be quite useful was Apple's own
on Cocoa application development. Again, this tutorial is aimed at those who already know about programming and everything that goes with it (memory management, MVC pattern and OOP), but it's an incredibly useful resource for getting a feel for Cocoa and Xcode.
Anyway, what would a post discussing new development endeavours be without a screenshot? So here it is, the best Cocoa application ever created. My take on the currency convertor tutorial!
I'm impressed at how easy it was to get the application to look good. I can't claim any credit for the gradient background or the rounded widgets; it's all part of OSX! Without having any knowledge of Objective C and Cocoa, I'd say it took me an hour in total to get that application running (that includes reading all tutorials, messing around with Xcode's settings and then writing the application itself). The great thing is, if you know C or Java, you should understand how it all works because the principals are the same (in fact, Objective C is a superset of C, meaning everything in C is included in Objective C!).
Being serious, I know that this application is hugely trivial and that I have a vast amount of knowledge and experience to gain when it comes to Objective C and Cocoa, but I think I've achieved quite a bit for an hour of hacking. I'm also quite impressed with what I've seen so far in terms of Xcode and how it enforces the MVC pattern. Equally impressive are all of the little things which make development so easy, such as the way tab chain-of-focus is setup (see the Apple tutorial) and the way anchoring works (there is a superbly useful animation on the "Size" property window which shows what will happen to your widgets when the window is resized based on your current selections - take that Visual Studio!)
For anyone interested in following in my footsteps, I read the Objective C tutorial, followed by the Cocoa tutorial and finished with the Apple tutorial. This is probably the best order in which to read as each subsequent tutorial will make more sense after reading the previous one.