Sitemap
Adam Iredale

Adam Iredale

iOS Professional, Meditator, Tea Enthusiast, PWNc

Getting started with iOS development in the age of Swift

A brief recommendation on how to start developing for iOS today

5 min readJul 14, 2014

--

Which language should I learn? Objective-C or Swift?

The short answer is: both. Apple’s new language is in headlines and clickbait everywhere in the iOS and OS X development world today — but don’t be fooled. It will be many moons before Swift is fully integrated into the developer workflow and Objective-C is going nowhere fast. I recommend that budding iOS developers take their first steps in Objective-C and here’s a few reasons why:

Apple’s frameworks are built in Objective-C and C

They’ll likely start to transition everyone over to Swift gradually but for the main part, they’re in the same boat that we’re in. A little over a month ago, only 200 developers were actively using Swift. Apple kept Swift close to their chests as they built it up over a period of 4 years. Up until the Keynote this year, all but 200 of Apple’s internal developers apparently had no clue about it either. Objective-C is robust, and has stood the test of over 20 years of use.

Swift is still in beta and is subject to change

Xcode 6 beta 3 made some significant changes to the way that arrays and dictionaries work and broke a lot of prior code. Learning a language is hard enough without having to learn what is and isn’t your fault. Swift will continue to make breaking changes until at least version 1.0 in a few months. Any oddity in Objective-C is generally widely known and documented.

Swift was designed for interoperability with Objective-C and uses the same runtime

Most things you learn in Objective-C can be mapped to a conceptual understanding in Swift, and as most of the iOS and OS X developers have been writing in Objective-C up until this point, some concepts are easier to understand if you first know Objective-C.

Objective-C material is everywhere

Objective-C tutorials and examples permeate the web. Books on iOS development are all (at this stage) written in Objective-C. Stack Overflow, Ray Wenderlich and countless other tutorial sites are filled with iOS tutorials, examples and workarounds — all in Objective-C. It’s been used for over 20 years! As you learn how to develop for iOS and run into problems or have questions, the answers you seek will still (for a long while) be written in Objective-C.

Legacy code takes a long time to die

Even when Swift has been fully embraced by the developer community in their daily grind, there are still going to be billions and billions of lines of legacy code written in Objective-C. You can’t fix or convert what you don’t understand. In addition, there are thousands of third party libraries and powerful tools that (still) use Objective-C, so an understanding of how these work is vital for adopting them with confidence.

By starting with Objective-C, you will build a firm foundation for iOS development and learn a lot of the Cocoa frameworks that Swift also uses.

Learning Objective-C

From Apple with love

The best place to begin is at the source: Apple’s iOS Developer Library. There are a tonne of guides, documentation and sample code here. In order to point you in the right direction, I recommend starting with these:

  1. Start Developing iOS Apps Today
  2. Programming with Objective-C
  3. Concepts in Objective-C Programming
  4. Adopting Modern Objective-C
  5. Coding Guidelines for Cocoa
  6. Foundation Framework Reference

You’ll also want to check out the iOS Human Interface Guidelines, commonly known by developers as “the HIG”. I quite often tweet about #badUX and #livebythehig and this is the reference manual to which I refer. The sheer number of horrible apps that exist tell me that not enough developers are taking the time and care to read and apply the design guidelines in this excellent manual.

Other helpful resources

Luca Bernardi and Alberto De Bortoli have just released an excellent free style guide for writing beautiful Objective-C (highly recommended).

Get Adam Iredale’s stories in your inbox

Join Medium for free to get updates from this writer.

Ray Wenderlich is an excellent resource for learning iOS development, and I’d recommend that you at least buy the “iOS 7 by tutorials” book and consume it (and iOS 8, once it’s ready). Once you understand the basics of Objective-C, this particular guide will help you understand how to use it with outstanding easy-to-read tutorials. In addition, Ray’s site is so chock-full of tutorials and guides that you may find everything you need there (so do all the freely provided ones first and consider whether or not a subscription would benefit you).

If video is your thing then you should check out NSScreencast. It offers subscribers (and occasionally has some free videos too) weekly, highly-polished walkthroughs of many areas of development for iOS, delivered as screencasts. It covers tools, techniques, frameworks and a lot more. Well worth a look.

Next up, Swift

Don’t rush into learning Swift. A good understanding of Objective-C and iOS development in general is far more important at this point than Swift. It is still in flux and many errors that you will encounter may not be your fault at all, which is a horrible learning experience. With that in mind, here is the order that I recommend people use to learn Swift with the least amount of hair-pulling and screaming:

Videos

Visit WWDC 2014's video page and watch these sessions in order:

  1. 402 — Introduction to Swift
  2. 403 — Intermediate Swift
  3. 404 — Advanced Swift
  4. 406 — Integrating Swift with Objective-C
  5. 407 — Swift Interoperability In Depth
  6. 408 — Swift Playgrounds
  7. 409 — Introduction to LLDB and the Swift REPL
  8. 410 — Advanced Swift Debugging in LLDB

There is also a great demo of some of the powerful features of Swift and Playgrounds given in the Platforms State of the Union video.

Don’t worry if you don’t pick up all the details. The videos will lay the groundwork for your documentation ingestion. Once you’ve watched the videos, you’ll be able to absorb the documentation much faster than I did (I read the docs first over several mind-bloating days).

Documentation

Parts of the iOS 8 pre-release documentation have been released as two free iBooks on iTunes, but either source is fine to use. I recommend the former (also available from the Help menu in Xcode 6), as it opens easily as a Playground where available.

You’ll want to read:

  1. The Swift Programming Language*
  2. Using Swift with Cocoa and Objective-C
  3. Swift Standard Library Reference

*When reading the Swift Programming Language, read it in the following order: Language Reference, Language Guide, Welcome. This order is not intuitive, but it will allow fastest absorption. The reference quickly covers the important points about the language, the guide covers the language with worked examples and the welcome contains an interactive Playground that you can use to test your understanding.

Moving forwards by looking backwards

After all this learning, you may want to go back to the examples that you’ve built in Objective-C and consider how they would be best implemented in Swift. A simple port might be your first step, but also consider that Swift is very different from Objective-C and may have new tools that would solve the problems in a different way. We’re all learning at this stage, so experiment often, and tell others your findings.

With that, I leave you with my wish for you of only the Swiftest of experiences, developing Objectively great apps. Good luck!

--

--

Adam Iredale
Adam Iredale