This post is a free translation of an Xcode article , Supercharged .
For us, as engineers, it is very important to get used to the tools that we use in our work every day, but you should never dwell on their study. There will always be hidden opportunities that help us work faster and concentrate on the goal, rather than on the means to achieve it. I will show some of the "chips" that I discovered during my work in the Xcode development environment. I hope they will be useful to you.
')
1. Ctrl + numbers
Xcode has quick navigation throughout the project: from the root directory to the files and methods in them. Just press
Ctrl + numbers from 1 to 6 and see for yourself. Search also appears in the windows that appear.
2. “Chips” of breakpoints
Breakpoints are great. They can also be "charged." Did you know that you can perform LLVM commands and even play back alerts when a breakpoint is triggered? And you can combine this with continuous execution (when you need to understand that the method is being called, but you do not need to stop the application).
3. Fuzzy search anywhere
Can't remember where you saw something in the code? In Xcode, there is a fuzzy search in the whole project -
Cmd + Shift + O. The key point is precisely in fuzziness: if there are too many search results, just continue typing until you find what you are looking for.
4. Editing in scope (in Scope)
Place the cursor on the name of the method or variable and press
Cmd + Ctrl + E. Note how each mention of this word is highlighted. It is enough to change this name once and Xcode will change it everywhere in the class in which it is used. This is very convenient to use when you need to quickly rename a variable or method. It also works for local variables in their scopes. This is especially convenient when you give a name to a property / method, and then change your mind.
5. camelCase selection
This "trick" works great in combination with the previous one. In Xcode, you can quickly select camelCase text with
Ctrl + Shift + right / left arrow . You just quickly highlight the words in the variable name. It is very convenient. Note that this may conflict with system settings, especially with switching between workspaces in OS X.
6. Simple switching between code and navigator
Want to quickly switch from editor to file navigator?
Cmd + Shift + J and you're already there. Want to go back to the editor? And so as not to reach for the mouse or trackpad? Please:
cmd + j . A bonus to this is a quick search for files in the navigator. Just press
Cmd + Option (Alt) + J.
7. Breakpoints on variables
Put a breakpoint on the line with the declaration of the variable and Xcode will stop there every time the variable value changes
(in fact, in this example, the breakpoint works because the didSet (...) {...} method is described in the same line) .
8. Quickly go to the definition
You clicked
Cmd and clicked on the name of a variable or method to figure out what it is? Put the cursor in the text and press
Cmd + Ctrl + J. This also works for your own definitions.
9. Differences from the last commit
Who needs third-party git tools if you can see the differences right inside Xcode?
Cmd + Shift + Alt + Enter (Return) .
10. Quick work with breakpoints
Click
Cmd + \ to set or remove breakpoint in the line where the cursor is located. You can also use
Cmd + Y to turn breakpoints on and off throughout the entire project.
These key combinations became part of my daily work and helped speed up coding and making changes. If any of these combinations conflict with another setting that you made before, you can always change them. Just press
Cmd +, (comma) and go to Key Bindings. Good luck to you fast programming!