Fastlane is a tool that will help you with during your app deployment process in different ways :
– Take screenshot while running your iOS Unit Tests
– Simplify the provisioning profile management
– Build the application and upload it to iTunes connect along with metadata (app localized description, app category …)
Fastlane Setup
If not already installed, simply follow the Fastlane setup guide : https://docs.fastlane.tools/getting-started/ios/setup/.
Simply run the “fastlane init” command in your Xcode project repository and select the options that suit your needs you will see a fastlane/ folder.
Fastlane is a bunch of Ruby gems which you can run on command line, you can specify how to run those gems by editing the fastlane/Fastfile file.
Fastlane Customisation
As fastlane init deploys a default template, it would be a better idea to save the fastlane/ folder somewhere and to edit it to configure general descriptions, and default options so you only have to configure a few things before running fastlane commands.
In fastlane/metadata/ you can configure all the metadata of your app. Simply run the “fastlane deliver” command just after !
You can automate the snapshot taking process for different iPhone and iPads by adding the following helper file to your UI Tests scheme and simply calling its setupSnapshot method during the SetUp process and its snapshot method when you reached a correct screen : mZone-Final.zip (Extract the mZonePokerUITests/SnapshotHelper.swift file, the related tutorial is really nice to read too !).
In the fastline/Snapfile file you can configure the devices you want screenshots for and expected languages :
# A list of devices you want to take the screenshots from devices([ "iPhone 5", "iPhone 6", "iPhone 6 Plus" ]) # A list of supported languages languages([ 'en-US', 'fr-FR' ]) # Where should the resulting screenshots be stored? output_directory "./fastlane/screenshots" # Clears previous screenshots clear_previous_screenshots true # Latest version of iOS ios_version '10.1'
Finally fill in the fastlane/Appfile and fastlane/Deliverfile with your personal info and you can run either default fastlane commands and lanes defined in fastlane/Fastfile (fastlane lane_name).