36

I am wondering is there any shortcut or hotkey that can apply the fix-it suggestion from Xcode? (Xcode 7)
In Android Studio, we can just use ctrl+enter to apply the correction. Is there anything similar to that in Xcode?
some ref: https://swifteducation.github.io/assets/pdfs/XcodeKeyboardShortcuts.pdf

Yao
  • 709
  • 2
  • 11
  • 22

5 Answers5

28

In Xcode 8, this appears to now be ⌃⌥⌘F or Ctrl + Alt + Cmd + F

If you want to change it, go to Xcode > Preference > Key Bindings and search for Fix all in scope.

yvette
  • 361
  • 4
  • 6
26

I am aware of two shortcuts.

Ctrl + Cmd + ' - auto fix next error
Ctrl + Cmd + " - auto fix prev error

Enjoy!

scope
  • 1,967
  • 14
  • 15
15

control - option - command - f

f

Then

enter

To get out of split view.

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
8

Here are the default key bindings for XCode 8

enter image description here

arcseldon
  • 35,523
  • 17
  • 121
  • 125
  • 4
    This solution is awesome... but whenever I press the ctrl alt cmd F while fixing all issues, assistant editor shows up... turns out to be some bug in Xcode since 7... I changed this to ctrl+shift+f and works fine (it overlaps with some text edit function which I do not use) – Dominik Bucher Sep 25 '18 at 12:41
4

Xcode Fix an issue

Unlike Android Studio where you can apply a fix to a single issue, the Xcode are able to fix all issues at time via Editor -> Fix All Issues

yoAlex5
  • 29,217
  • 8
  • 193
  • 205