Episode #155

xcconfig Files Part 2

6 minutes
Published on February 5, 2015

This video is only available to subscribers. Get access to this video and 586 others.

Continuing from last week's episode, this time we talk about adding environment-specific settings in xcconfig files, have them pre-processed into the Info.plist, and also how to integrate this technique with CocoaPods.

Episode Links

  • Source Code
  • BuildSettingExtractor - James Dempsey wrote a nice utility that will extract the build settings from an Xcode project and place them in a file to avoid the manual copy/paste work we did in Episode 154. Great work, James!

Custom Environment Settings

GOOGLE_ANALYTICS_KEY = UA-dev
FACEBOOK_APP_ID = fb-dev
API_URL = dev.myserver.com

Take care not to include http:// in the URL, because it will be treated like a comma.

Use these in the Info.plist like:

  • ${GOOGLE_ANALYTICS_KEY}
  • ${FACEBOOK_APP_ID}
  • ${API_URL}

Incorporating CocoaPods Configuration

// Debug.xcconfig
#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"

// Release.xcconfig
#include "Pods/Target Support Files/Pods/Pods.release.xcconfig"

// ...