How to toggle running Xcode project in debug or release mode by using only shortcut keys?

Solution 1:

Debugging build: "Product" Menu => "Build For" => "Running" (shift-command-R)

Release build: "Product" Menu => "Build For" => "Profiling" (shift-command-I)

Run without building (whichever you just built): "Product" menu => "Perform Action" => "Run without building" (control-command-R)

Solution 2:

There is one way that I use it for my projects.

In Xcode, go to the the project settings (project, not target) and add "beta" configuration to the list:

enter image description here



Then you need to create new scheme that will run project in "beta" configuration. To create scheme go here:

enter image description here



Name this scheme whatever you want. The you should edit settings for this scheme. To do this, tap here:

enter image description here



Select Archive tab where you can select Build configuration

enter image description here



Then you need to add a key Config with value $(CONFIGURATION) the projects info property list like this:

enter image description here



Then its just the matter what you need in code to do something specific to beta build:

let config = Bundle.main.object(forInfoDictionaryKey: "Config") as! String
if config == "Release" {
  // app running in release configuration
}
else if config == "Beta" {
  // app running in beta configuration
}