This repo is a working demo for my talk @SwiftHeroes2020
Slides are available here
This project can be a good starting point for any "fresh project" that is about to start. It's a good showcase of tools that improves code quality (SwiftFormat and SwiftLint), helps managing the "xcodeproj" merge conflict hell (XCodeGen) and creates static references to resources (with SwiftGen). The final goal is to have a project ready to be shared with other developers (without the hassle of explaining the steps to rebuild a working environment) and ready to be used in a CI/CD environment
This is not an "architectural" repo, and swift code inside is not following any particular best practice related to architectural/pattern stuff.
- A working XCode installation (with command-line-tools installed)
- Working Ruby environment (system default or
rbenv/rvm) bundlerinstalled (gem install bundler, withsudoif needed)homebrewinstalled (/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)")
make setupwill install every dependency (either tools AND code dependencies like Pods) and create xcodeproj with XCodeGenmake cleanremoves Pods folder and XCode project/workspacemakeormake projectwill create xcodeproj (according toproject.ymlfile) and reinstall podsmake resourceswill create generated resources files with SwiftGen (according toswiftgen.yml). Configuration folder contains templates for colors, images and translations, and specific json file for colors.make formatwill automatically apply formatting rules through SwiftFormat (check.swiftformatfile for rules) and SwiftLint (check.swiftlint.ymlfor rules).make dependenciesis the same asbundle exec pod install --repo-updatemake update_dependenciesrunsbundle exec pod update.make git_setupcreates a pre-commit git hook that runs SwiftFormat and SwiftLint (with proper rules, seemake format) on every file added or modified inside a commit.
On some git installations, the git hooks folder may not be present. In that cases, simply run
git initand try again
To change your project name, close your workspace, edit Makefile by changing export APP_NAME = "<yourAppName" and run make setup again
Same thing for bundle identifier and every environment variable you can think about :)
Contributions are more than welcomed!