I want to share my shortcuts and tips on Xcode that I use mostly. I am using latest Xcode version as much as possible. If you are here, probably you already downloaded Xcode but in any case I am dropping link here. Download Latest Xcode!
1. Hide Errors
When you deal with large projects and want to see only warning instead of like framework warnings etc. press ‘Show only errors’ button in the Issue Navigator.
2. CMD + SHIFT + F
CMD + SHIFT + F is your Google in the Xcode. Even for your Storyboard files. I know, you are already know the how to search in Xcode but you have to know this shortcut. This will save time for you. You will use every minute.
3. Selecting Words
I could create new list item for every shortcut that below but I think they should be together. They are related in a way while you are editing your code.
- If you want to move your cursor word by word press ALT (Option) like this (with left or right arrow of course):
- You don’t want to just move your cursor, also want to select words, you have press SHIFT with ALT. Like this:
- Let’s selecting multiple lines with multiple cursors with same alignment. To do this, you have to press ALT(Option) and selecting with mouse.
- Last thing about moving cursor or selecting word is depends on camelCase. If you using camelCase and want to selecting words one by one ALT(Option) won’t work. Instead of using ALT you have to use CONTROL. CONTROL + SHIFT + arrow key will let you select camelCase variable word by word.
4. Focused Editor
When you use divided code screens in Xcode, surfing between files could be very painful. While you are editing your code in left pane and want to show different file in right pane you should drag files or select file above from the pane. To prevent accidental clicks and maximize your performance I should you do this:
Xcode > Preferences > Navigation > Navigation: Uses Focused editor
5. CMD + SHIFT + O
If you want to open a file or an app in your mac you are using CMD + Space, right? (I hope, you are). In Xcode, you could open a file without searching in folders or anywhere else. Just use CMD + Shift + O. As you guess letter of O refers to ‘open’.
6. MARK: and TODO:
One of the useful thing is for the future of yourself and colleagues is using “// MARK:”. If you want to separate with line you can put – end of the Mark like this: “// MARK: – “. MARK will let inform you and your friends with comment line.
Also, you could add “TODO: -” for the next improvements to note yourself -or others. Besides, your MARK’s and TODO’s will show on when you navigate to related items like this:
7. Zoom In and Out in Storyboard
If you are using track pad and want to zoom in, in storyboard with mouse you have press ALT(Option) and Scoll In with mouse. This is much easier than pressing + and – buttons in storyboard.