This is a tutorial explaining how to kickoff an iOS project from scratch (some steps can't be followed without being granted access to certain services).
The following will be needed to start an iOS project kickoff process:
- Have access to project's GitHub repository.
- Make sure
wolox-ci
GitHub user has writing access to repository. - Have AmazonS3 credentials to configure CarthageCache.
- Verify access to project's iOS devs email
PROJECT_NAME-dev-ios@wolox.com.ar
. - Verify access to project's Trello or Jira board.
- Verify access to project's Google Drive.
- Have XCode and XCode Command Line Tools installed.
- Have git and Homebrew installed.
- Have rbenv installed.
The following steps will get your iOS project configured. Replace Project Name
with your project name.
A little heads up: It's extremely important naming conventions, such as camel case notation and so on, are followed. I.e.: if BaseProject.xcodeproj
should be renamed with our project name, then it should be ProjectName.xcodeproj
. Always follow the naming pattern on the base project. Read this Convention guide to figure out what the Project Name
should be. There can't be symbols like -
in the new project's name or the renaming won't work.
Follow this guide sequentially, don't skip or mix steps.
First, clone the Base Project repository. The included project comes with a basic XCode configuration and includes the most useful/needed dependencies.
Also clone from GitHub the empty project repository for our new project.
Now we should fast copy everything but the .git file from base project to our project. Remember to change project-name-ios
with our project folder name.
$ rsync -av --progress ios-base-project/. project-name-ios --exclude .git
Now create a branch for setup (call it something like project-initial-setup
) and commit and push the changes.
Open your XCode project and change its name from BaseProject
to your own ProjectName
following this tutorial.
After doing this you'll note that the ProjectName
's Scheme
hasn't been renamed. To do this, duplicate the actual scheme and rename it and only then delete the old scheme. While editing the scheme, tick the shared
option so the project can be run on a CI environment. Here's a gif of the process:
Folders and groups should also be renamed. To do this you can use the rename
script that is in the root of the project by running: ./rename
and following the steps.
Time to move on to install the build scripts that will bootstrap our project. To do this clone or download this repository.
Before doing anything check in a terminal the value for xcodebuild -version
and the latest versions of SwiftLint and Carthage.
You can check them in SwiftLint releases and Carthage releases.
Now run ./install <your project directory>
and follow the steps. Select the options you need for your project. If you are not sure you can use the default values the script provides (by pressing return
when asked for a value) in almost all cases except for:
The name of your project.
When asked to create a .env
file select y
.
When the script asks for xCode, Swiftlint and Carthage versions use the values you searched for above.
Bootstraping the project will install every necessary dependency to build the project.
This will configure CarthageCache locally and generate a .carthage_cache.yml
file. Have your AWS credentials handy: you'll need the access key ID
and secret access key
from the account with access to the carthage-cache
bucket. Configure us-west-2
as region. When done, you should see this message on the console:
ProjectName successfully bootstrapped
Useful scripts:
* 'script/test' to run tests.
* 'script/build' to build the project.
* 'script/update' to update project's dependencies.
You can start hacking by executing:
open ProjectName.xcodeproj
Move to the project's root folder and download the Fastlane content from the Fastlane repository by doing:
git clone --depth=1 https://github.com/Wolox/fastlane-mobile.git fastlane
rm -rf fastlane/.git
This copies the fastlane-mobile
repository into fastlane
folder, and removes the .git
directory.
Make sure the project can be built and run it on the simulator (⌘ + R). You should see the following screen:
If everything works, commit and push your changes.
To configure continuous integration follow the guide CI configuration for iOS projects
The project integrates Rollbar as default crash logger.
In order to enable it, ask a technical leader to create a new group and a new iOS project in Rollbar.
Once created, sign in to Rollbar, and go to your project's "Settings" -> "Access Tokens".
Then copy into all the .xcconfig
files the following content replacing with the tokens:
ROLLBAR_CLIENT_ACCESS_TOKEN = <token under "post_client_item">
ROLLBAR_SERVER_ACCESS_TOKEN = <token under "post_server_item">
Once the .xcconfig
files are configured (make sure they are ignored, if they are shown as changes to be committed, then do git update-index --assume-unchanged ./BaseProject/ConfigurationFiles/*
to ignore these changes) just uncomment the call to RollbarService().initialize()
in AppDelegate.swift
.