Skip to main content

Xcode 7: Hiding Code Coverage Data

·1 min

One of Xcode 7’s new features is measuring your project’s code coverage when running unit tests. Go to the scheme editor, select the Test step, and select the Gather coverage data checkbox.

After running your unit tests, the Xcode editor will display code coverage data for your source code files. Code that was not exercised will be highlighted in the editor. On the right side of the editor, Xcode displays the number of times each line of code was exercised, an iteration count, when you ran the tests.

This code coverage data is nice to see after running unit tests, but the data can be distracting when you go back to writing code. How do you tell Xcode to stop showing the code coverage data in the editor?

Use the Editor menu. Choose Editor > Code Coverage > Hide Code Coverage. There is also a menu item in the Code Coverage submenu to hide the iteration counts on the right side of the editor. If you want to see the code coverage data again, choose Editor > Code Coverage > Show Code Coverage.