Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode fix-it shortcut

Tags:

hotkeys

xcode7

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

like image 291
Yao Avatar asked Dec 22 '15 20:12

Yao


People also ask

How to Fix all in Xcode?

Conversation. Xcode tip #5: If you have a Swift file with many errors, you can use Xcode's fix-its to try to correct them one by one. But a faster way is to go to the Editor menu and choose Fix All Issues to apply fix-its all at once. (Make sure and double-check which changes were made!)

How to Fix code in Xcode?

Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.

How to Fix all warnings in Xcode?

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.


2 Answers

I am aware of two shortcuts.

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

Enjoy!

like image 171
scope Avatar answered Oct 11 '22 03:10

scope


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.

like image 39
yvette Avatar answered Oct 11 '22 02:10

yvette