Journey into iOS: Days 1 through 3

Or how I learned to break my brain

For the past two months I have been attending Code Fellows in Seattle, WA learning to be a web developer. I had been nibbling around the edges of that world for some time and I finally had the opportunity to jump in head first. Which I did. And it hurt. I left there most evenings unsure of how to spell name and spent the rest of the night trying to recover and prepare for another beating in the morning. Learning HTML, CSS, and Javascript was an incredibly satisfying experience, but the further I got into it, the more I noticed myself peaking into what was going on in the Apple universe.

I jumped on the Apple bandwagon when I first attended college. I was studying audio production and the two requirements for me to be successful, in my mind, was having a copy of Pro Tools and having a Mac. Ever since then I have happily enjoyed the ride of this particular bandwagon. Bringing it back to today, it just so happened that the iOS development course was starting up right after I was finishing up with intermediate web development. Needless to say, I jumped on that opportunity which leads us to right now. This is going to be an ongoing account of my experience learning Swift (and Objective-C) and developing for iOS.

The first week of class is all about getting acquainted with Swift as a language. Day One was pretty straightforward. We discussed: variables, data types, loops, and functions. The concepts were all straightforward, but as soon as we were let loose to work on our assignments, I started second guessing myself on how you are supposed to write a function. It felt like I was starting from the beginning again. This is what I ended up with.

func reversedString(_ str: String) {
let reversed = String(str.characters.reversed())
reversedString(“This is a reversal”)

My brain felt like it was running backwards at this point.

Overall, it was a fairly simple day that would help lay the groundwork for the lessons of day two.

Day two was a doozy. We started the morning off, bright and early, with closures and optionals. We demoed trailing closures and how to unwrap optionals the safe way all before the coffee even had a chance to start taking effect.

var number : Int? // The “?” sets the optional so number could be nil
number = 10
// Good way of unwrapping. We are only unwrapping on the scope of the if let
if let number = number {
print(“Number was unwrapped to: \(number)”)

These are the notes of someone who is not awake

After a quick break and a refill on the coffee we did a deep dive into collections and some popular methods associated with them.

We covered:

  • Arrays — just like I remembered them from Javascript
  • Dictionaries — [key : value]
  • Sets — arrays, just not indexed
  • Methods (Reduce, map, and filter)

We were then set free to answer some vaguely worded questions in a new Xcode playground. I felt really confident going into this assignment, but found myself confused by what I was trying to produce. For some reason my brain just ran into a brick wall trying to comprehend the questions. The code was easy, but it got to the point where I had to walk away and look at it in the morning.

Day three. Today was all about Structs, Classes, extensions, and the introduction of protocol based programming. We walked through how build a Struct and how they differ with Classes. We touched on the differences of where they are stored in memory (Structs in the stack, Classes in the heap) and some high level use cases for each. After building out a couple examples of Structs and Classes, we learned how to start implementing protocols to make our code cleaner and safer. Once that was finished and I consumed my lunch, we were set free to work on the days assignment. This lab was ingenious with how each step built on top of the next.

The todo lab:

  1. Define a protocol that is going to take a String
  2. Declare a class that conforms to the protocol we just defined
  3. Define another protocol that lays down the road map of our functionality
  4. Create another class that conforms to our second protocol and implements the required methods

The final class I defined looked like this

class Store : ObjectStore{
    var chores : [ToDo]
    init(chores : [ToDo] = []){
        self.chores = chores
    func add(object: String){
        let newTodo = ToDo(text: object)
    func remove(object: String){
        for (index, todo) in chores.enumerated(){
            if todo.text == object {
                chores.remove(at: index)
    func objectAtIndex(index: Int){
    func count(){
    func allObjects(){
        for toDo in chores {

I had one of those cool ‘aha!’ moments seeing how all of these pieces are coming together. It was fun playing in the console, adding items, removing them, and counting them up. Simple things, but I can see where this is headed and it is exciting.

This week so far has been a little abstract with the content. After this week we will be building apps and putting these concepts to work in a real world environment. Right now I am putting my trust that all of the concepts will come together and make a lot more sense when I have made my own version of Twitter. I can’t wait for tomorrow.