What is fastlane?
fastlane is an open source platform aimed at simplifying Android and iOS deployment. fastlane lets you automate every aspect of your development and release workflow.
In this tutorial we will see how to setup fastlane using Swift. At the end of the this tutorial we will share another tutorial for Gitlab CI + fastlane to completely automate your build process for TestFlight.
Below steps we are gonna follow to setup fastlane using Swift
1. Setup Xcode project and create respective App ID, Provisioning Profiles
2. Create New App in iTunes Connect
3. Setup and install FastLane to Application
4. FastFile Configuration
Step 1: Setup Xcode project and create respective App ID, Provisioning Profiles
- Create a new Xcode Project
- Go to Developer Account and create App Id for the project
- Create provisioning profiles for both Development and Distribution using the created App Id for the App
- After creating the Provisioning Profiles, go to General Tab of the app Target and uncheck Automatically Manage Signing
- Select Signing Debug (Development) and Signing Release(Distribution) profiles
- If Provisioning profiles are not installed in Key-chain, click Download Profile, it will display the profiles available in Developer portal
2. Create New App in iTunes Connect
- Go to iTunes Connect and create a new app with the bundle identifier of the app created
3. Setup and install FastLane to Application
- First go into the project directory from terminal and Install fastlane. If need try command with sudo
[sudo] gem install fastlane -NV
- Then setup Fast lane for swift using
fastlane init swift
- After this setup is complete, there will be four options available as below
1. 📸 Automate screenshots 2. 👩✈️ Automate beta distribution to TestFlight 3. 🚀 Automate App Store distribution 4. 🛠 Manual setup - manually setup your project to automate your tasks
- Select option 4 , during the set up it will prompt with some instructions twice, press Enter for those two and the setup will be completed.
- When the setup is complete, Open the project file located directory to configure your lanes in Fastfile.swift
[projectDirectory]/fastlane/Fastfile.swift
- Edit the custom Lane function as follow
- To upload the build to TestFlight execute below command in terminal
fastlane customLane
- This command will generate the .ipa file and build will be uploaded to TestFlight.
To setup complete automation of build release whenever your master branch has updated follow below tutorial.
Gitlab CI to TestFlight By Fastlane using Swift – Step by step tutorial
Leave a Reply