New Cocoa Programmers, iOS, Objective-C and Swift
2 minutes read
Not long ago I got curious about native app development, so I started on the basics.
Gearing up for some solid learning. Starting with C++ and heading to iOS & Android. Future is full of more knowledge!
— Jabran Rafique (@jabranr) May 6, 2014
I began by reading up on the iOS and Android ecosystems. The more I read, the more I wanted to start with iOS, even though I know some Java and had never touched the C family. So these days I'm mostly reading about and practising iOS development.
I'll admit the C style syntax is what held me back at first. But the way to get over a fear is to face it. Objective-C's names are extra long and a bit awkward to type at first. The upside is that they're easy to read and explain themselves, so you can tell what a method does from its name alone. For example:
- (void) didReceiveMemoryWarning { … }
I'm a web developer used to rather different languages, so some of the C family is exciting and confusing at once. All programming languages share the same core ideas, though, so it's mostly a matter of getting used to the extra-lengthy-excitingly-confusing syntax.
So far so good. Objective-C is fun to learn. Since I knew nothing about the C family, I'm taking the chance to learn C++ on the side as well.
Then came WWDC 2014, where Apple announced the Swift language as a replacement for Objective-C. Apple's reasons for retiring a 20 year old language have drawn mixed reactions from Cocoa developers. I'm only just getting started, so I'm not really in a position to judge the decision. I'll just say why I'm excited.
Swift seems to drop the complicated naming conventions and long syntax, and it looks a lot more like JavaScript. That's great news for people like me who are coming to native mobile development from the web. Matt Bridges has a good piece on Swift's syntax on Medium.
Apple has also released a guide to Swift that goes well beyond the basics. You can download it as an eBook from iTunes or iBooks.
Apple still supports Objective-C, and you can use both languages in the same app. An easy to learn new language doesn't mean I'll drop Objective-C and C++ halfway through. I'll carry on with them and add Swift to the list, in time for the iOS 8 release this autumn, since Swift is where Cocoa apps are heading.
Happy learning!