Keyboard shortcuts enhance developer productivity immensely. There are so many, and so many I underutilize regularly (a few on handling navigational tabs come to mind). Here are some of my most used keyboard shortcuts in the app I use daily, Xcode.
-
- ⌘ + r
- Build and run your app.
-
- ⌘ + b
- Build your app, unfortunately required for some files to get code completion working again.
-
- ⌘ + shift + k
- Clean the project; useful for building your app when Xcode may have unfortunately cached a built file and it needs to be rebuilt!
-
- ⌘ + shift + j
- Shows the location in the Project navigator where the currently editing file is - expanding any folder or group in it’s path.
-
- control + i
- Auto-formats and indents the selected text in the editor.
-
- ⌘ + o
- Open a file by starting a search, search for files (most accurate), classes, and methods; the latter two are flaky in frameworks and sometimes go to Swift generated headers. 😑
-
- control + 6
- While editing a (perhaps lengthy) view controller, this can help search for a view method inside it – when you follow up with typing “viewdi…” to start to filter for methods in the file. This can also find TODOs and upon pressing return can take you directly to the line of code.
-
- ⌘ + option + =
- While in Interface Builder, this will take the currently selected object and adjust the frame, useful for autolayout repositioning.
-
- esc
- Code hinting.
There are so many shortcuts that could help my workflow even more than these. I am looking forward to workflow improvements with the newly announced Xcode 9.
Software versions used at the time of writing: Xcode 8.3.3.