Fix issues while writing code

The source editor scans as you type and marks any issues it detects. You can then apply a suggested correction in a Fix-it dialog to repair your code.

Important: To use Fix-it, you must build the target with the LLVM or Swift compiler, the indexing of your project must be complete, and “Show live issues” must be selected in general preferences. Fix-it works with Swift, C, Objective-C, and Objective-C++.

Make a Fix-it correction

  1. Enter code in a source file.

    The source editor marks issues with a red underline at the position of the issue, and displays a summary of the issue to the right.

  2. When the issue summary appears, click the icon on the left of the summary text.

    A Fix-it popover appears that describes the problem and suggests corrections.

  3. To select a correction, click the Fix button. To cancel, press the Esc (Escape) key.

Navigate between Fix-it issues