Ry's Objective-C Tutorial

TL;DR: An especially good tutorial for Objective-C from RyPress, which covers all the basics, without being too basic.

Over the years, I've used a few languages, starting with Pascal and Delphi then Java and C#, amongst others. Objective-C was always an oddball language because of its syntax and industry usage. It felt like C, but then there were the square brackets everywhere! However, in a lot of ways it was a long way ahead of its time: message passing and forwarding, protocols, dynamic typing, categories. Even back in 1996 when we did it at University, it felt different, and yet a lot more powerful than the current languages of the time (C, C++ and Java for me back then).

Since 2002, I've been firmly in the C# camp, which has evolved from a basic Delphi-like language (with squiggly brackets) into a well designed, fully formed language with a huge class library. Objective-C hadn't moved much until Apple released iOS, and when I first looked into iOS development, it felt old - its core ways of working hadn't moved with the times, manual memory management being one of the major things I wasn't willing to go back to.

Since then, Apple has done some fantastic work making it a more modern language, but without breaking the original spirit of the language. Properties, dot notation, ARC, blocks and literals go a long way to making me like the language.

A lot of it is the compiler writing code for you, eg:

{% codeblock lang:objc %} id object1 = [someArray objectAtIndex:0];
{% endcodeblock %}


{% codeblock lang:objc %} id object1 = someArray[0];
{% endcodeblock %}

But thats what the compiler should be there for - to make your life easier and safer, and to force you to write less (or no) boiler plate code. Ruby and Rails got this right in a big way, with rails at times feeling like it's own language.

Most of my mobile work, however, is in MonoTouch and Mono for Android, which is all C#-based. However, most samples for iOS development are in Objective-C, being able to at least read Objective-C code is (or should be) a requisite requirement for anyone doing iOS development with any tool - XCode, MonoTouch, RobyMotion, and even Phonegap.

The same goes for Android development: if you want to be effective, learn to read Java (thankfully, thats quite easy for C# developers).

Matt Gemmell linked to an especially good tutorial for Objective-C from RyPress, which covers all the basics, without being too basic.

If you are doing iOS development in any language, it's well worth reading and understanding.