env variables in xcode

Setting ENV variables in XCode in not straighforward. I have broken down how to accomplish setting up an ENV variable in the following videos and code example.

{% youtube r5HZwbkA52I %} Make a new conifuration file and set any ENV variables you need.

{% youtube jwuQgWb58Xs %} In the debug environment, use the debug.xcconfig file. Then, assign the value to something, in this case, SignUpUrl corresponds with the SIGN_UP_URL, which is set to localhost:4567/sign_up.

  var info:[NSObject:AnyObject] = NSBundle.mainBundle().infoDictionary!
  var sign_up_url = info["SignUpUrl"] as! String

The sign_up_url variable is set to localhost:4567/signup.

Helpful Links

Configuring ENV Variables in XCode

comments powered by Disqus