xccache

< Knowledge Base

✍🏼 Case Study: Using XCCache in Kickstarter iOS Project

Let’s try this xccache tool with the Kickstarter iOS project.

I forked the project to trinhngocthuyen/kickstarter-ios. Check out the branch try/xccache for the detailed integration.

Following are the steps needed for the integration.

Step 1. Add xccache to Gemfile

Then, run bundle install to have it installed.

Step 2. [Optional] Using existing remote cache

Specify the git repo for the cache in xccache.yml.

remote:
  default:
    git: https://github.com/trinhngocthuyen/.cache.git

Then, pull the cache from the given repo:

bundle exec xccache remote pull

Now, the cache should be available in ~/.xccache/debug.

$  tree ~/.xccache/debug -L 2

/Users/thuyen/.xccache/debug
β”œβ”€β”€ Alamofire
β”‚Β Β  └── Alamofire-513364f8.xcframework
β”œβ”€β”€ AlamofireImage
β”‚Β Β  └── AlamofireImage-1eaf3b6.xcframework
β”œβ”€β”€ Apollo
β”‚Β Β  └── Apollo-5db23797b.xcframework
β”œβ”€β”€ ApolloAPI
β”‚Β Β  └── ApolloAPI-5db23797b.xcframework
β”œβ”€β”€ ApolloUtils
β”‚Β Β  └── ApolloUtils-5db23797b.xcframework
β”œβ”€β”€ AppboyKit
β”‚Β Β  └── AppboyKit-a3511ca.xcframework
β”œβ”€β”€ AppboySegment
β”‚Β Β  └── AppboySegment-dc659b7.xcframework
β”œβ”€β”€ AppboyUI
β”‚Β Β  └── AppboyUI-a3511ca.xcframework

Step 3. Run bundle exec xccache to integrate the cache

There are some highlighting changes as follows:

Step 4. Trigger β€œResolve Package Versions”

Tip: You should trigger this after running xccache command because Xcode doesn’t auto-resolve dependencies upon changes in xccache’s package manifest.

Step 5. Try a clean build

And observe the build time when having cache. The observed buid time on my Macbook Air (M1, 2020) is just nearly 2 minutes πŸŽ‰.