From Ruby to Swift

Matt Packer
3 min readNov 3, 2016

--

Scale Up

As a student at Turing School of Software & Design, I have spent the majority of my time focused on Ruby, Rails, and JavaScript. In the final Module at Turing, students are presented with Scale Up, where students choose to either work on a brownfield project or complete an independent study. I chose to pursue an independent study with a focus of learning Swift and incorporating what I learn in a presentable project.

Background

Earlier in my time at Turing, I built EarlyBird, an online tee time booking system. With this, I built a separate EarlyBird API to serve up golf course data (names, addresses, phone numbers, images, and tee times). My goal for Scale Up was to build a native iOS App that would compliment my module three project, EarlyBird.

Minimum Viable Product (MVP)

I always like to have a plan. Therefore, my first step was to identify what I considered to be an acceptable MVP. I concluded that my App should accomplish the following using Swift:

  • Consume golf course data from the EarlyBird API
  • Display golf course data in a UITableView
  • Allow users to book a tee time.

Without this functionality, users would have a hard time understanding the value that the App delivers.

Docs & Tutorials

After solidifying my MVP, I read some Swift documentation:

The documentation gave me a basic understanding Swift’s syntax and structure.

Next, I identified a suitable tutorial.

There are plenty of companies offering Swift tutorials, but I landed on Team Treehouse. The company was familiar and offered Network Programming with Swift 2. This seemed like a perfect place to start.

Barriers

While completing Network Programming with Swift 2, I discovered that I was having a challenging time adjusting to my new IDE, Xcode.

Because of the rapid development rate of Swift, most tutorials I found were written in the context of Swift 2. For this project, however, I was working with Swift 3. Oftentimes, Xcode’s linter would provide helpful suggestions for avoiding compiling errors, but this was not always the case. Additionally, most blogs and tutorials use storyboards, interactive builder, and cocoa pods. I found each of these to add to my confusion. I just wanted to write working code. Therefore, I began searching for how to consume an API in Swift programmatically. Eventually, I found Simple REST API Calls in Swift and the tutorial’s update for Swift 3. These tutorials were amazing. Christina Moulton at Grok Swift was easy to follow and provided thorough examples. This was the first resource that led to significant progress on my project.

With the help of her tutorials I was able to incorporate what I learned to consume my EarlyBird API, parse the data, and display course names and addresses in my UITableView.

Result

I realized that I was running out of time and needed to identify how I could satisfy my last MVP requirement: allow users to book a tee time. After discussing this with fellow students, I landed on a solution. My App will allow users to browse a list of golf courses natively. Then, once a user taps on a course, the browser will open externally (rather than inside the App), and they will be directed to the selected golf course on my EarlyBird Rails App. From here, users can continue to book their tee time by selecting the number of players and the stored player names. Once they tap “Confirm”, the user can view all of their past orders and a text message containing the confirmation code is sent using Twilio. To accomplish this I simply modified the views in my Rails App to accommodate for mobile.

Below is an example of my MVP.

--

--