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
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!)
Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.
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.
I am aware of two shortcuts.
Ctrl + Cmd + '
- auto fix next errorCtrl + Cmd + "
- auto fix prev error
Enjoy!
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With