What is an Xcode Scheme? How do you configure a custom one?

This tests Xcode build orchestration. A scheme is a blueprint for build, test, run, profile, analyze actions; a strong answer covers duplicating it, setting launch arguments, and staging configs. A red flag is confusing schemes with build configurations.
WHAT THIS TESTS: This question evaluates whether you understand Xcode's build orchestration layer and can automate environment-specific workflows without polluting source code. Interviewers want to see that you know the difference between a scheme, a target, and a build configuration, and that you can use schemes to streamline team workflows.
A GOOD ANSWER COVERS: First, define an Xcode scheme as a blueprint that controls what happens when you build, test, run, profile, analyze, or archive a target. Second, explain that schemes are per-user and can be duplicated and renamed without affecting the underlying target. Third, describe practical customization such as opening the scheme editor, selecting the Run action, and adding command-line arguments or environment variables in the Arguments tab. Fourth, mention pairing a custom scheme with a custom build configuration, for example creating a Staging configuration in the project settings and then selecting it in the scheme's Build action so that the app compiles with staging flags. Fifth, note that schemes can be shared via version control by checking the Shared checkbox, which moves the scheme file into the xcshareddata directory so teammates can use it.
COMMON WRONG ANSWERS: A major red flag is conflating schemes with build configurations. A build configuration is a collection of compiler settings, while a scheme is an orchestration layer that decides which configuration to use for each action. Another red flag is suggesting that you should hardcode environment checks in Swift code with if statements checking the bundle identifier or a custom flag, rather than using scheme-level arguments or configurations. Saying that schemes are stored inside the target or project file is also incorrect; they live in the xcuserdata or xcshareddata folders.
LIKELY FOLLOW-UPS: The interviewer might ask how you would keep secrets out of a scheme while still using environment variables. They might also ask about the difference between a shared scheme and a user-specific scheme, or how you would configure a scheme to run UI tests against a mocked backend. Another common follow-up is how pre-actions and post-actions in a scheme can be used to run scripts before or after specific build phases.
ONE CONCRETE EXAMPLE: Suppose you need a Staging scheme that points to a staging API and logs verbosely. You would create a new build configuration called Staging by duplicating Debug in the project settings and adding a SWIFT_ACTIVE_COMPILATION_CONDITIONS flag named STAGING. Then you duplicate the main app scheme, rename it Staging, and in the Build action select the Staging configuration. In the Run action under Arguments, you add a launch argument like --verbose-logging and an environment variable named API_BASE_URL with the staging endpoint. Finally, you mark the scheme as shared so the whole team can select Staging from the scheme picker and launch the app preconfigured without editing code.
Read the original → developer.apple.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.