Skip to content
Fast build times for big Swift projects
Ruby Swift Shell
Branch: master
Clone or download
michaeleisel Merge pull request #1 from daveverwer/master
README clarifications and updates
Latest commit 3454d01 Jan 24, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
ExampleApp update readme Jan 16, 2020
bin wip Jan 16, 2020
exe nice Jan 16, 2020
lib bump to 0.1.1 Jan 16, 2020
.gitignore wip Jan 16, 2020
Gemfile wip Jan 16, 2020
LICENSE.txt wip Jan 16, 2020 Removed duplication in Usage section. Jan 24, 2020
Rakefile wip Jan 16, 2020
xcode_barber.gemspec nice Jan 16, 2020


Fast build times for big Swift projects

How it works

Why compile your whole app and run the same steps to navigate to it every time you run when you're just working on a single view controller or a smaller section of your app?

To improve build times, and your productivity in this situation, why not swap in a small AppDelegate that runs a smaller section of your app? Use Barber to strip your unused dependencies and speed things up.

Note: Barber only trims Swift dependencies, not Objective-C ones.


[sudo] gem install xcode_barber


  1. First, add a new AppDelegate that focuses on a specific view controller or section of your app.
  2. Temporarily prevent the existing AppDelegate from being compiled. The easiest way to achieve this is to select it in the Project Navigator and use the File Inspector to remove it from the Target Membership for the target.
  3. Build the app and ensure that everything is working you expect.

Then, run barber. Pass the target name, the project file path, the new AppDelegate path, and the path to the directory that contains the swiftdeps files for the project.

barber -t MyTarget -r MyApp/AppDelegate.swift -p MyApp/MyApp.xcodeproj -d ~/.../DerivedData/MyApp-asdf/path/to/swiftdeps/files

That’s it! The project no longer compiles unnecessary files. To reset everything, just discard your .pbxproj file changes.

Example app

You can see a full example in the ExampleApp directory.

Any issues?

Computing dependencies is tricky. If it didn't work for you, feel free to create a GitHub issue. You can expect a prompt response!

You can’t perform that action at this time.