Cheatsheet Xcode
IDE oficial da Apple para iOS, macOS, watchOS e tvOS (Swift/Objective-C)
Xcode
File and Project
New file
⌘ + N
Creates a new file.
Close window
⌘ + W
Closes the active window/tab.
New project
⇧ + ⌘ + N
Creates a new project.
Open quickly
⇧ + ⌘ + O
Opens any file by name (Open Quickly).
Save
⌘ + S
Saves the current file.
Preferences
⌘ + ,
Opens the Xcode preferences.
Save all
⌥ + ⌘ + S
Saves all files.
Edition
Undo / Redo
⌘ + Z (undo)
⇧ + ⌘ + Z (redo)
Reverts or reapplies actions.
Move line
⌥ + ⌘ + [ (up)
⌥ + ⌘ + ] (down)
Moves the current line.
Cut / Copy / Paste
⌘ + X (cut)
⌘ + C (copy)
⌘ + V (paste)
Clipboard.
Indent / outdent
⌘ + ] (indent)
⌘ + [ (outdent)
Adjusts the indentation.
Select all
⌘ + A
Selects all content.
Re-indent selection
⌃ + I
Re-indents the selected text.
Comment / uncomment
⌘ + /
Comments or uncomments the line.
Navigation
Open quickly
⇧ + ⌘ + O
Searches files and symbols (Open Quickly).
Open in Assistant
⌥ + ⌘ + ,
Opens the file in the assistant editor.
Go to line
⌘ + L
Jumps to a line number.
Jump bar
⌃ + 6
Opens the jump bar for file symbols.
Go to definition
⌃ + ⌘ + J (or ⌘ + Click)
Jumps to the symbol definition.
Related file
⌃ + ⌘ + ↑
Switches between .h and .m (counterpart).
Back / forward
⌃ + ⌘ + ← (back)
⌃ + ⌘ + → (forward)
Navigates the position history.
Search and Replace
Search
⌘ + F
Searches in the current file.
Next / previous
⌘ + G (next)
⇧ + ⌘ + G (previous)
Navigates the results.
Find and replace
⌥ + ⌘ + F
Finds and replaces in the file.
Search in project
⇧ + ⌘ + F
Searches across the whole project.
Replace in project
⌥ + ⇧ + ⌘ + F
Replaces across the whole project.
Code
Autocomplete
Esc (or ⌃ + Space)
Shows autocomplete suggestions.
Edit all occurrences
⌃ + ⌘ + E
Edits all occurrences of the symbol.
Quick documentation
⌥ + ⌘ + ?
Shows the symbol documentation (Quick Help).
Wrap in
Editor > Structure > Wrap
Wraps the code in if/with/etc.
Generate documentation
⌥ + ⌘ + /
Adds a documentation comment.
Show file inspector
⌥ + ⌘ + 1
Opens the file inspector.
Build and Execution
Build
⌘ + B
Builds the project.
Analyze
⇧ + ⌘ + B
Runs the static analyzer.
Run
⌘ + R
Builds and runs the app.
Test
⌘ + U
Runs the unit tests.
Stop
⌘ + .
Stops the running execution.
Profile (Instruments)
⌘ + I
Opens Instruments for profiling.
Clean build
⇧ + ⌘ + K
Cleans the build folder.
Edit scheme
⌘ + <
Opens the scheme configuration.
Debugging
Toggle breakpoint
⌘ + \
Adds/removes a breakpoint on the line.
Step out
F8
Steps out of the current function.
Continue / pause
⌃ + ⌘ + Y
Continues or pauses execution.
Enable/disable breakpoints
⇧ + ⌘ + Y
Enables or disables all breakpoints.
Step over
F6
Advances one line (without stepping in).
LLDB console
(lldb) po object
Prints the description of an object.
Step into
F7
Steps into the called function.
Browser and Panels
Show/hide navigator
⌘ + 0
Toggles the navigator visibility.
Toolbar
⌥ + ⌘ + T
Shows/hides the toolbar.
Navigator panels
⌘ + 1 … 9
Opens the navigator panel (1=project, 3=find…).
Organizer
⇧ + ⌘ + 2
Opens the Organizer (windows, devices).
Show/hide inspector
⌥ + ⌘ + 0
Toggles the inspector visibility.
Full-screen editor
⌃ + ⌘ + Enter
Enables full-screen editor mode.
Debug area
⇧ + ⌘ + Y
Shows/hides the debug area.