title: How to access Build Settings in Xcode 6?
body: <p>There seems to be a lot of variations of how to access the Build Settings variables (i.e. to define the base URL of a web service for different <code>Debug</code> vs. <code>Release</code> environments). </p>
  
  <p>I created a User-Defined variable in Project -> Building Settings, one for each environment. Let's call it <code>WEB_SERVICE_BASE_URL</code>.</p>
  
  <p>How do I access it in the code? I'm using XCode 6 and Swift.</p>
  
  <p>I've tried this but it doesn't work</p>
  
  <pre><code>let api_key = ${WEB_SERVICE_BASE_URL}
  </code></pre>
  
  <p>I've also tried this and it also doesn't work</p>
  
  <pre><code>let api_key = NSUserDefaults.standardUserDefaults().stringForKey("WEB_SERVICE_BASE_URL")
  </code></pre>
  
  <p>Any suggestions? This seems to be a often needed solution, it's so easy in Rails, but not so in iOS development.</p>