9

I've been switching 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 run through all the warnings and use the "Fix-it" tool to auto correct it?

I would like to review each warning, then click a button to fix the warning, and then skip to next warning. Otherwise it's going to take me a few hours to manually get through each warning.

Cœur
  • 37,241
  • 25
  • 195
  • 267
TWilly
  • 4,863
  • 3
  • 43
  • 73
  • 1
    Use Command+' to navigate to the next warning, review it, then hit Return to apply the auto-fix. Repeat. – Darren Mar 04 '16 at 19:02
  • i'd use the "issue navigator" to click through the warning and call the quickfixes – Christian Dietrich Mar 04 '16 at 19:03
  • 1
    Note: this is **not** a duplicate of [Run all of Xcode's “Fix-it”s at once](http://stackoverflow.com/q/32505307/77567), because TWilly wants to review each warning and Fix-it, not blindly apply them all. – rob mayoff Mar 04 '16 at 19:38
  • @robmayoff how is this not a duplicate? The solution is nearly identical, and your answer is nearly identical to the second answer in the dupe target. – JAL Mar 04 '16 at 19:41
  • Because the linked Q&A is about applying all Fix-its without individual review, but TWilly wants to review each Fix-it before applying it. – rob mayoff Mar 04 '16 at 19:42

3 Answers3

12

Your best bet is to use keyboard shortcuts. The default keyboard shortcut for Navigate > Jump to Next Issue is ⌘' (command-single-quote). If you press it, Xcode will jump to the next issue it knows about. If that issue has a Fix-it available, the Fix-it popover will appear automatically and you can press return to execute the Fix-it, or press ⌘' to leave the code unchanged and go to the next issue, or press escape to leave the code unchanged and stay on that issue.

You can also open the Issue Navigator (default shortcut: ⌘4). Then you can click on issues one-by-one. If you click on an issue with a Fix-it, Xcode will show the Fix-it popover and you can press return to execute the Fix-it.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
1

Previous answer is best solution,before doing it you must Fix Validate project Settings (Update to recommended Settings).Suppose you decided to fix it last,it may again arises some new warnings.

Anees
  • 514
  • 5
  • 20
1

control - option - command - f

f

Just type

Enter

afterward to adjust back to normal screens view.

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85