A quick way to fix Xcode warnings

I switched between versions of Swift in Xcode 6, and my project now has 220 warnings. Mostly minor code suggestions.

Is there an easy way in Xcode to go through all the warnings and use the Fix-it tool to automatically fix it?

I would like to review each warning, then press a button to fix the warning, and then move on to the next warning. Otherwise, it will take me several hours to manually go through each warning.

+9
ios xcode swift
source share
3 answers

It’s best to use keyboard shortcuts. The default keyboard for navigation> Go to the next problem is ⌘ ' (single quote command). If you click it, Xcode will move on to the next issue that he knows about. If this problem has Fix-it, Fix-it popover will appear automatically, and you can press return to execute Fix-it, or press ⌘ ' to leave the code unchanged and go to the next problem or press escape to leave the code unchanged and stay in this matter.

You can also open the Problem Navigator (default shortcut: ⌘4 ). Then you can click on the numbers one by one. If you click on a fix-it problem, Xcode will show a fix-it popover, and you can press return to execute the fix-it.

+12
source share

The previous answer is the best solution, before you do this, you must fix Check the project parameters (update to the recommended settings). Assume that you decide to fix it last, it may again generate some new warnings.

+1
source share

If you want to view and apply Xcode suggestions automatically:

manage - option - command - f

βŒƒ βŒ₯ ⌘ f

Just enter

⌘ Enter

after that, to return to the normal view of the screens.

+1
source share

All Articles