Most software projects use add-ons and libraries to make development easier (one popular add-on for package management in the iOS development world is Cocoapods). Using package managers makes working with 3rd-party libraries easier. Projects like this normally require additional setup and or configuration.
To save time, the setup and build process is usually automated. This project uses GNU Make. At the time of writing the setup chain defines the following rules that do the following things (defined in the Makefile):
-
Rule:
generate
- Creates a
user.xconfig
file that allows different developers to enter their individual configurations (it's gitignored) - Runs two scripts (
ensure-xcodegen.sh
,ensure-swiftlint.sh
) that installs a specified version of Xcodegen and Swiftlint respectively. The scripts download the appropriate version, if they are not available - Runs Xcodegen
- Creates a
-
Rule:
lint
- Runs a script
- Runs SwiftLint
The Area51 team uses XcodeGen to generate the Area51.xcodeproj
file to make sure there are no merge conflicts when multiple developers are adding files. And SwiftLint to enforce a code style which is standard across many companies.
Even though the generate
command sounds similar, they are different here:
make generate
executes amake
rule calledgenerate
(see the Makefile).xcodegen generate
executes the programxcodegen
with the subcommandgenerate
The control flow is as follows:
- Once the app starts (eg tapping on the icon), iOS calls the
AppDelegate.swift
. - In Area51 this tells the
NavigationRouter.swift
to load. - The NavigationRouter instantiates the tabs (at the time of writing the feedController and the settingsController) and sets them up in the tab bar at the bottom.
- Bot controllers get added into an array of controllers and iOS presents the item in the first position in this array.
- In the case of Area51 the feedController itself already does some things (like opening a subreddit). You can checkout the code for that in the
FeedViewController.swift