Creating the custom flag

To create a custom flag, we need to be in the project's Build Settings tab:

  1. Search for Other Swift Flags (you are using the search box for this stuff, aren't you?) in the build settings.
  2. Click on the disclosure triangle next to Other Swift Flags to see the build configurations.
  3. Open the Dev build-configuration text field by double-clicking on the right-hand side of that row.
  4. Click in the + in the bottom-left corner of the window that opens.
  1. Enter -DDEV (including the - character) into the text field and hit return:
  1. Click outside the window to close it.

The -D tells the compiler that this is a flag it needs to know about. As for DEV, it's just a string; it can be anything you want. Tradition dictates that preprocessor strings (and that's what this is; see the information box in the further section) are written in uppercase.

That's it; we're done with the Build Settings tab for the time being, let's move on to some code.