Key commands and other tips for Xcode.
Xcode it not Eclipse but it still has a ton of features, much of these are hidden away. Which is a good thing but we are power users and therefore we could gain a lot by exploring! I remember when Xcode and IB was two different tools and this is a list of some of the most useful tricks I have gathered over the years.
Key commands:
- Switch tabs: ⌘ + ⇧ + [
- Comment out selection: ⌘ + /
- Move line up/down, respects indentation: ⌘ + ⎇ + [ ]
- Indent left/right: ⌘ + [ ]
- Format selection: ⌃ + I
- Follow: ⎇ + click
- Follow in new window: ⌘ + double click
- Open in assistans editor: ⌘ + ⎇ + click
- Inline documentation: ⎇ + Click
- Select column: ⎇ + select
- Reveal in project navigator: ⌘ + ⇧ + J
- Clean console: ⌘ + K
- Edit in scope: ⌃ + ⌘ + E
- Show Navigator: ⌘ + 1…8
- Hide Navigator: ⌘ + 0
- Show/Hide Utilities: ⌘ + ⎇ + 0
- Dropdowns: ⌃ + 1…6
- Recursive filters
- Enable/Disable breakpoints: ⌘ + y
- Add/Remove breakpoint at current line: ⌘ + \
- Move focus in editor: ⌘ + J
- Run: ⌘ + R
- Build: ⌘ + B
- Inspect: ⌘ + I
- Stop: ⌘ + .
- Test: ⌘ + U
- Clean: ⌘ + ⇧ + K
- Fold scope: ⌘ + ⎇ + <-
- Unfold scope: ⌘ + ⎇ + ->
- Fold all: ⌘ + ⎇ + ⇧ + <-
Behaviors:
- Build fails: Navigate to first issue
- Running completes: Hide navigator/utilities
- Custom behavior: Connect to key command
- Speak announcements =)
Exceptions:
- No need to build & run loop.
- Configure with conditions.
Debug view hierarchy:
- Click the small icon on the debug-toolbar.
- Great for debugging auto-layout constraints.
- Reveal is a lot more powerful! You can edit live data.
Alcatraz:
- Package manager for Xcode: ⌘ + ⇧ + 9
- Disclaimer: New Xcode version will probably break.
- http://alcatraz.io
Code snippets:
- Add your own.
- Download from github: https://github.com/burczyk/XcodeSwiftSnippets
4-square-menu:
- Only Obj-C for now.
- Extremely useful!
Misc:
- Line numbers n settings.
- Code folding!
- Show TODOs and FIXMEs and warnings
- Treat warnings as errors for Release-build
- Move function pointer while debugging - Auch!
Questions & Your Tips