Achieving Nerdvana: Learning Swift for iOS at Big Nerd Ranch

Posted:
in General Discussion edited August 2015
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.

Comments

  • Reply 1 of 9
    SpamSandwichSpamSandwich Posts: 30,580member
    Sounds like a worthwhile investment of one's time for programmers, but it should be noted that programming is a way of life that requires constant use of learned skills and continual education. It's not for slackers.
  • Reply 2 of 9
    MacProMacPro Posts: 17,892member
    Sounds like a worthwhile investment of one's time for programmers, but it should be noted that programming is a way of life that requires constant use of learned skills and continual education. It's not for slackers.

    Ok you convinced me, I cancelled ... ;)
  • Reply 3 of 9
    SpamSandwichSpamSandwich Posts: 30,580member
    Ok you convinced me, I cancelled ... ;)

    I tried for several years to create an app, which ended up going nowhere. A hard lesson, but lesson learned.
  • Reply 4 of 9
    am8449am8449 Posts: 343member
    This one time, at coding camp...
  • Reply 5 of 9

    Thanks for the article.   I have been thinking about getting back into programming and SWIFT looks like a good place to dive in.   But for me its been years (Basic, Fortran and CPS were the last programs I did).  How easy would it be for someone with simply a rudimentary knowledge of programming, but no knowledge of current programming languages?   Would this be a good beginner class or is this more for those who already program and want to simply add skills in Swift?

     

    FYI Apple does a terrific job of providing free manuals in the bookstore (iTunes App store books, Swift Programming v 2 Beta (just updated a couple of days ago))

  • Reply 6 of 9
    pdq2pdq2 Posts: 270member
    One potentially useful (and low cost - zero, that is) resource is courses from Stanford's CS department through iTunes U. They released one in January that is for Swift beginners that have some previous coding experience. They have lecture video (which can be run at various speeds) and class notes, etc.

    I haven't made it through it yet, so I can't speak to that. But it seems pretty good.
  • Reply 7 of 9
    Quote:
    Originally Posted by pdq2 View Post



    One potentially useful (and low cost - zero, that is) resource is courses from Stanford's CS department through iTunes U. They released one in January that is for Swift beginners that have some previous coding experience. They have lecture video (which can be run at various speeds) and class notes, etc.



    I haven't made it through it yet, so I can't speak to that. But it seems pretty good.

     

    I have listened to Paul Hegarty for years, and each year I learn something new and acquire more knowledge and expertise due to his teachings. He makes the obscure seem very easy. If you want to learn Swift on the cheap, his Stanford class is fantastic on iTunes U.

  • Reply 8 of 9
    emoeller, I would recommend it for people who know a little bit about programming but not much about Swift or iOS. It's taught very well.
  • Reply 9 of 9
    emoelleremoeller Posts: 415member

    "emoeller, I would recommend it for people who know a little bit about programming but not much about Swift or iOS. It's taught very well."

     

    ?Thank you for the advice.   I'll try the iTunesU lecture series first, as that may provide a good introduction for me before taking a full course.

Sign In or Register to comment.