With its origins at NeXT, Big Nerd Ranch is one of the more respected iOS app development companies in the world. At a recent coding retreat put on by BNR, I survived seven days of the most intensive programming instruction of my life, and lived to write about it.
After Apple announced Swift 2.0 at WWDC this past June, I realized that it had acquired a lot more support and had more or less stabilized as a language. I needed to learn it fast if I wanted to teach iOS with it in Sept., so I signed up for a week of learning iOS with Swift at Big Nerd Ranch's West Coast location at Asilomar Conference Grounds in Pacific Grove, Calif.
The Saturday I arrived, I met our instructor, Scott Ritchie, a former NeXT and Apple employee and Cocoa/Cocoa Touch wizard that also does corporate training for companies like Facebook and Google. I found him to be incredibly outgoing, personable, and funny. He even brought his guitar, he told us, for our lab times at night if we ever just wanted to chill out from the insane amount of code we ended up writing. Major cool points. After hanging out with the class on the beach for some pre-class down time, I turned in for the night in order to get some rest for what would be the most intensive educational week of my life. Thankfully, the accommodations at Asilomar are rustic, but clean, comfortable, and relatively quiet.
Since we had already read the first eight chapters of the pre-reading assignment dealing with basic types and program control, the first two days were dedicated to understanding the more complex aspects of Swift: Optionals, Arrays, Dictionaries, Sets, Functions, Closures, Enumerations, Structs and Classes, Properties, Initialization, Protocols, Extensions, Generics, and Automatic Reference Counting.
Needless to say, outside of an explicit iOS context, the first two days included a lot of fairly abstract language instruction, but as programming languages go, Swift brings with it some features that make for safer, more reliable and reusable code. For example, sometimes a value might need to be set to "nil" (essentially, having no value) as when a Label is first instantiated on an iPhone screen. Optionals are a Swift feature that enable programmers to know when a value has returned no value. In Objective-C, there was no way for a program to detect this, since messages could return nil and continue to run.
Swift makes code safer by requiring all variables to have values at initialization, and can prompt programmers as to when lack of value might be a problem instead of hiding it as potential bug to fix later down the road.
Swift makes code safer by requiring all variables to have values at initialization, and can prompt programmers as to when lack of value might be a problem instead of hiding it as potential bug to fix later down the road. In addition, Objective-C did not enable multiple inheritance (wherein one class inherits from multiple other classes). In Swift, classes and other types can conform to multiple protocols (which can themselves inherit from other protocols and have their functionality extended).
The class format consisted of Scott walking us through a concept with some slides, and then giving us some time to code the examples in the chapter. This did not mean reading the chapter, but rather simply typing in the example code. I made the mistake of trying to read the chapters as I coded and fell behind fairly quickly. Depending on the length of the chapter, there was about 20-30 minutes to code the examples. As we progressed, the time span became less and less sufficient as new topics were introduced regardless of whether or not everyone had finished coding.
However, with Scott present to answer any questions, this wasn't as much a problem as I initially thought it would be. His presentations were clear and concise, and he made sometimes difficult concepts easy to understand with great examples and illustrations. I didn't really get as much out of the second day of instruction because at about 9 a.m. that morning I received a notification that my app (which I had been working on for the previous 3 years) had gone into review, so that was on my mind all day. Then, that afternoon, I was notified that it had been approved for the App Store, so that pretty much dominated my thinking for rest of the night during the Lab.
With two days of Swift under our belts, we started the iOS component of the course on Tuesday, and it ran until the end of the course on Friday. We began by building a simple quiz app from scratch, and by "from scratch" I don't mean a single-view template in Xcode. Historically, BNR prefers to build apps from the ground up, starting with creating a UIWindow in the App Delegate file. For non-coders, that means instead of using Xcode's convenient "Storyboards" feature that allows users to chain XIB files together in one editor pane. Scott did an excellent job teaching this chapter, and within minutes, I had built a quiz app of my own, from the barest of bones.
From a quiz app we built a more advanced tab bar app the utilized the CGRect class and UIPickerView and then transitioned to a more involved UITableView application that included a detail page that allowed editing of the items along with a photo taken from the camera or photo library. Later in the week we utilized Storyboards to create a ColorPalette app which used the UISlider class to change RGB values on the view controller.
We also covered handling touch events, gesture recognizers, menu controllers, and collection views. The last of these were used to create Photorama app that fetched data from the Flickr API to populate a collection view of photos. At night we would continue coding in the Lab and sometimes take a break to catch the sunset on the beach.
Photo courtesy @jaimerios
By the end of the week, I had become fairly comfortable building a simple quiz app from scratch, using design patterns taught during the week. I had also made some helpful connections with other students who were from various backgrounds and degrees of experience building iOS apps. I think that was the best part of the entire week; the immersive atmosphere that Big Nerd Ranch offers to budding iOS developers. Impromptu discussions, instructor Q&A, and time together discussion our aspirations, concerns, and dreams all served to make my seven days at Asilomar the best programming week of my life.
I highly recommend Big Nerd Ranch to anyone who really wants to learn deeply the craft of building applications for iOS.