Choose Your Own Adventure with Environment Variables
We fixed a performance bug and verified behavior with our generated test data, but we don’t want to have to manually change the Objective-C code when we want to choose a data scenario. Instead we’ll choose which message to send to the data factory on the fly during application launch based on an environment-variable value.
Every Unix process, including iOS and OS X apps, has a set of variables made visible through that process’s environment. We can assign any string value we want to these environment variables through Xcode schemes, as we’ll see in a moment, and even from the command line, which we’ll use in Chapter 10, Command-Line Workflow.
Rather than hard-code the call to generate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access