Fastlane - Improve Swift/Obj-C Workflow

Published Dec 08, 2017Last updated Mar 25, 2018
Fastlane - Improve Swift/Obj-C Workflow

The Breakdown

As developers, we love it when our job is automated for us.

One of the most hated processes is submitting code for review. Every freelance developer, every aspiring at-home code monkey, knows just how painful this can be.

But what if it didn't have to be so painful? What if someone already created a tool that made this, and many other processes, streamlined?

I myself hate submitting code, especially to Apple. The iTunes Connect system is one of the most involved, complicated, tools I've ever used.

It took me weeks to even understand how to submit an archive — never mind setting up notifications, figuring out what signing profiles I needed locally, and so much more.

It got to be quite frustrating.

That's when I stumbled upon Fastlane. Fastlane is a Ruby-based toolset made up of so many different modules. It has saved me and thousands of other developers many painful hours of trying to figure out what to do.

It manages signing, uploading, running tests and taking screenshots, uploading and entering in required metadata, and a ton of other things. It can even let your friends on Slack know that you've pushed a new build!

The Tools

Fastlane is made up of 11 basic modules, as of this article. I'm going to cover them all in categories, leaving the more intimate details for the reader to discover!

Signing: Pem, sigh, match, cert

We all know iTunes Connect and XCode can be major pains when it comes to certifications and signing. The developers of Fastlane agree, and created these four modules to help out!

  • Pem lets you create new push notification profiles, while its cohort cert takes care of normal code signing profiles.
  • Match maintains a list of all your certs, of whatever type, and uploads them to a private repository on GitHub. No more re-generating certs!
  • And finally, sigh matches your mood when iTunes Connect tells you that you don't have the right certificates. It automatically attempts to provision whatever code you're messing with at the time!

Building: gym, scan

  • Gym is a buff module that automatically takes care of building your app, taking into account all resources and bringing them together into an archive. This is usually the first step when you run Fastlane, and one of the most important!
  • Scan allows you to automate running tests for iOS applications. Gotta make sure the app works as expected!

Producing: deliver, snapshot/frameit, produce, precheck

Creating a new application on the iTunes Connect dashboard is an exciting moment, but can also be one full of confusion.

  • Produce simplifies the process down to an easy set of questions on command line.

  • Every good app needs screenshots to make it look good, right? That's where snapshot and frameit come in. Snapshot integrates with XCTests and scan, allowing you to automate taking the required screenshots on any device!

  • Precheck then tests your app and its metadata against some rules created by the community that closely mirror the App Store. This helps with the pesky rejection that sometimes occurs.

  • Then, once everything's packaged up and ready to go, deliver sends your app on its way to iTunes Connect, including everything from the archive to screenshots and metadata!

TestFlight Tools: boarding, pilot

While not strictly shipped modules, boarding and pilot can play a vital role in getting your app out there in beta!

Boarding is a small pre-built script that's compatible with Heroku and other Infrastructure as a Service (IaaS) providers. It creates a simple signup page for your app, allowing users to input a name and email.

Boarding then works with Pilot on the back-end to manage and communicate with the iTunes Connect TestFlight database for your application.

The Whole Package

Now, I know what you're thinking. This all sounds great, but seems like a lot of work to set up, right? Well, not really.

Fastlane actually comes with a lot of quick and easy ways to set itself up! When you runfastlane from your terminal inside a project directory for the first time, Fastlane will configure itself by asking you a few simple questions about the project.

From there, it'll create a Fastfile, where you'll be able to configure options. It comes ready to go. Without any changes, you could easily run any of the prebuilt lanes.

Fastlane also has downloadable modules that can be added to it. The Fastlane community has created a vast number of resources that include everything from automatic version bumping to posting messages on Slack!

The Real Deal

Fastlane is a wonderful, open source, and community-driven tool. It has saved me and other developers like me over 10 million hours.

It integrates smoothly with XCode, iTunes Connect, and developer libraries like CocoaPods. Its documentation and resouces are vast and detailed. I consider it a must-have for any iOS developer, and I'm sure you will too.

Discover and read more posts from Mason Phillips
get started