Weekly Swift articles, podcasts and tips by John Sundell.

Using feature flags instead of feature branches

Published on 18 Jul 2018

Instead of using feature branches, I merge almost all of my code directly into master - and then I use feature flags to conditionally enable features when they're ready. That way I can avoid merge conflicts and keep shipping!

extension ListViewController {
    func addSearchIfNeeded() {
        // Rather than having to keep maintaining a separate
        // feature branch for a new feature, we can use a flag
        // to conditionally turn it on.
        guard FeatureFlags.searchEnabled else {

        let resultsVC = SearchResultsViewController()
        let searchVC = UISearchController(
            searchResultsController: resultsVC

        searchVC.searchResultsUpdater = resultsVC
        navigationItem.searchController = searchVC