xcconfig Files Part 2

Episode #155 | 6 minutes | published on February 5, 2015
Subscribers Only
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"

// ...
blog comments powered by Disqus