Swift Pair Programming – Day 5

screenshot-from-2016-11-10-100142Yesterday, Nick and I pair programmed Swift in Screenhero. We’ve been doing sorting algorithms over the past few weeks. This time we discussed changing up the game plan.

During our previous pairing sessions we created a playground in a swift ios project. Apparently, creating a playground in a project prevents you from getting real-time compilation and console output.

Another reason for working with Swift in a project, rather that just a playground, is that we’ll be able to utilize some of the libraries and frameworks that are available in a full project. To be honest, I’m not sure how to import a library or framework into a Swift playground.

Therefore, after listing these concerns with Nick, we decided to pair program within the confines of a project. In the past, Nick mentioned wanting to do some image manipulation. I’m most interested in setting up a single point of authentication with OAuth.

Combining these two desires together, we decided to code up an Instagram clone for our pairing sessions.

Last night we found p2/OAuth2, an open source OAuth project on github, that is written in Swift (our pairing language). I was about to clone the repo and import the contents into our project when Nick showed me some awesome new technology called CocoaPods.

Before I talk about CocoaPods, let me explain about package managers. Package managers are like magically updating software managers that pull the latest updates from an internet connected manager and bring all the files, dependencies, and configurations into computer automagically. All the computer scientists just cringed a little from my explanation. That’s fine. It works for me.

Usually these package managers, like homebrew, npm, and apt are used to update the packages on your computer. With CocoaPods the community has brought together a package manager for iOS applications!

We created a pod to download p2/Oauth2 and spent the rest of the pairing session configuring the pod and attempting to connect to Twitter’s API to get a list of Nick’s Twitter followers.

We didn’t manage to get the authentication working last night. Next week we’ll get the application to authenticate. Then I’d like to work on integrating Facebook. Then IG, if that’s possible.

This week, to prepare for our next programming session, I’ll be testing out the p2/OAuth2 code from my personal machine at home. And I’ll also be doing Ray’s tutorial on OAuth2 in Swift. Nothing like being prepared, setting an agenda, and checking off items on a list🙂

Author: David Neely

Professional Software Developer. Technology and Web Coordinator at the University of Hawaii's Manoa Career Center.