June 13, 2015

BaasBox and Swift - Part 1

BaasBox is a tool that allows you to quickly build a backend for an application. The getting started guide for using BaasBox is a little dated and written entirely in Objective-C. The tutorial is fine, but since I’m working in Swift day to day the application I was looking to build would also be in Swift.

My first thought was to just google around and find newer tutorials. I found a single post that seemed relevant, Swifing with BaasBox - Building a quiz app with BaasBox Rather than lose all hope I decided that porting the tutorial app to Swift might be a good exercise in BaasBox and might give me an idea if I liked the tool.

I cloned the starter project and created a swift branch started hacking away.

Next was the brute force method of including the BaasBox SDK:

  1. Downloaded the SDK and dragged the BaasBox-iOS-SDK” folder onto the root of the project.
  2. Created a bridging header to allow swift to import Objective-C source. Go to File -> New -> File -> iOS -> Header File. The naming is very specific, it should be [ProjectName]-Bridging-Header.h’.
  3. In Swift files you can now import BaasBox


The latest SDK and the skeleton project were on different versions so I needed to change some of the tests to get the project to compile.

From there I stepped through and converted each class from Objective-C to Swift. They were straight forward and I was expecting more difficulty. This gets us to the beginning of the tutorial, in the next post we’ll actually implement the tutorial in Swift.

3d blog Note

Previous post
Key listing support in Consul client For integration between ansible and consul I’ve been using a third party python client called consulate. It is decent, however both it and consul
Next post
BaasBox and Swift - Part 2 In my first post I stepped through the process of porting the skeleton of the BassBox tutorial from Objective-C to Swift. This post takes that