Xcode Keyboard Shortcuts Cheatsheet

🧭 Navigators

  • ⌘ 0 - Show/hide navigator
  • ⌘ 1-9 - Navigators
  • ⌘ 1 - Show Project navigator

Navigator Shortcuts in Xcode: Real-world Scenarios

Basic Navigator Controls

  • ⌘ 0 - Show/hide navigator
  • ⌘ 1-9 - Navigators
  • ⌘ 1 - Show Project navigator

Common Use Cases & Scenarios

1. Maximizing Screen Space (⌘ 0)

Scenario: You're debugging a complex UITableView implementation

  • You're deep into coding a custom cell layout
  • Your MacBook screen feels cramped
  • Hit ⌘ 0 to hide the navigator instantly
  • Get full-width code view for better focus
  • Hit ⌘ 0 again when you need to navigate files

2. Project Navigation (⌘ 1)

Scenario: Working on a large e-commerce app

  • Need to quickly switch between:
    • ProductViewController
    • ShoppingCartManager
    • PaymentService
  • Hit ⌘ 1 to show the project navigator
  • Quickly find and select files
  • Perfect for when you're juggling multiple related files

3. Advanced Navigator Usage (⌘ 1-9)

Common Navigator Panels:

  • ⌘ 1: Project files (most used)
  • ⌘ 2: Source Control - Check git changes
  • ⌘ 3: Symbol Navigator - Find classes/methods
  • ⌘ 4: Find Navigator - Search results
  • ⌘ 5: Issue Navigator - Errors/warnings
  • ⌘ 6: Test Navigator - Unit tests
  • ⌘ 7: Debug Navigator - Runtime info
  • ⌘ 8: Breakpoint Navigator
  • ⌘ 9: Report Navigator - Build logs

Real-world Examples:

1. Debug Session Workflow

1. Coding in full screen (Navigator hidden with ⌘ 0)
2. Hit error → Press ⌘ 5 to check Issues Navigator
3. Need to check git changes → ⌘ 2 for Source Control
4. Back to coding → ⌘ 1 for Project files

2. Testing Workflow

1. Writing unit tests → ⌘ 6 for Test Navigator
2. Running tests, got error → ⌘ 7 for Debug Navigator
3. Need to modify source → ⌘ 1 for Project files
4. Check test coverage → ⌘ 9 for Reports

3. Code Review Scenario

1. Start with ⌘ 2 to review pending changes
2. Use ⌘ 1 to navigate between modified files
3. Switch to ⌘ 5 to check for any warnings
4. Use ⌘ 3 to find specific method implementations

Pro Tips

  1. Quick Toggle:

    • Use ⌘ 0 frequently while coding to maximize screen space
    • Toggle back when you need to navigate
  2. Memory Trick:

    • Remember ⌘ 1 as your "home base"
    • Other navigators (⌘ 2-9) are contextual tools
  3. Efficiency Pattern:

    Common workflow:
    ⌘ 1 (find file) → ⌘ 0 (hide navigator) → code → ⌘ 1 (next file)
  4. Muscle Memory:

    • Practice using these shortcuts without looking
    • Start with ⌘ 0 and ⌘ 1
    • Gradually incorporate others as needed

🛠 Utilities

  • ⌥ ⌘ 0 - Show/hide Utilities
  • ⌥ ⌘ 1-5 - Inspectors
  • ⌥ ⌘ 4 - Show Attributes inspector

Xcode Utilities & Inspectors: Real-world Scenarios

Basic Utility Controls

  • ⌥ ⌘ 0 - Show/hide Utilities
  • ⌥ ⌘ 1-5 - Inspectors
  • ⌥ ⌘ 4 - Show Attributes inspector

Common Use Cases & Scenarios

1. Show/Hide Utilities (⌥ ⌘ 0)

Scenario: Building a Complex UI

Situation: Working on an Instagram-like app
1. Editing a complex collection view
2. Screen feels cramped with utilities panel
3. Quick `⌥ ⌘ 0` to hide utilities
4. Make code changes
5. `⌥ ⌘ 0` again to bring back utilities for UI tweaking

2. Inspector Panels (⌥ ⌘ 1-5)

Each number corresponds to different inspectors:

File Inspector (⌥ ⌘ 1)

Scenario: Setting Up Localization

Working on: Travel App
Task: Configure multiple language support
1. Select Main.storyboard
2. `⌥ ⌘ 1` to open File Inspector
3. Check "Localization" options
4. Add German and French support

Quick Help Inspector (⌥ ⌘ 2)

Scenario: Learning New APIs

Working on: Weather App
Task: Implementing CoreLocation
1. Select CLLocationManager in code
2. `⌥ ⌘ 2` to see documentation
3. Quick reference for available methods
4. Check usage requirements

Identity Inspector (⌥ ⌘ 3)

Scenario: Custom View Setup

Working on: Banking App
Task: Custom Transaction Cell
1. Select UITableViewCell in storyboard
2. `⌥ ⌘ 3` to open Identity Inspector
3. Set custom class to "TransactionCell"
4. Configure accessibility identifiers

Attributes Inspector (⌥ ⌘ 4)

Scenario: UI Fine-tuning

Working on: Food Delivery App
Task: Menu Item Display
1. Select UILabel for price
2. `⌥ ⌘ 4` for Attributes Inspector
3. Adjust:
   - Font size to 17
   - Color to system green
   - Text alignment to right
4. Select UIButton
5. Modify corner radius
6. Update content type

Size Inspector (⌥ ⌘ 5)

Scenario: Responsive Layout

Working on: Fitness App
Task: Workout Timer View
1. Select container view
2. `⌥ ⌘ 5` for Size Inspector
3. Set constraints:
   - Center X
   - Center Y
   - Fixed width/height
4. Adjust margins

Real-world Workflow Examples

1. UI Design Session

Typical flow:
1. `⌥ ⌘ 4` - Set basic attributes
2. `⌥ ⌘ 5` - Adjust constraints
3. `⌥ ⌘ 3` - Set custom classes
4. `⌥ ⌘ 0` - Hide utilities to preview

2. Storyboard Cleanup

Maintenance workflow:
1. `⌥ ⌘ 3` - Check view identifiers
2. `⌥ ⌘ 1` - Verify file settings
3. `⌥ ⌘ 4` - Update default values

3. Debug UI Issues

Problem-solving flow:
1. `⌥ ⌘ 5` - Check constraints
2. `⌥ ⌘ 4` - Verify attributes
3. `⌥ ⌘ 3` - Confirm correct classes

Pro Tips

  1. Quick Toggle Pattern:

    Common workflow:
    Code → `⌥ ⌘ 4` (check attributes) → `⌥ ⌘ 0` (hide) → code
  2. Efficient UI Development:

    • Keep utilities hidden while coding (⌥ ⌘ 0)
    • Show only when needed for UI adjustments
    • Use ⌥ ⌘ 4 as your main UI workspace
  3. Memory Tips:

    Remember order by usage:
    4 - Attributes (most used)
    5 - Size (constraints)
    3 - Identity (custom classes)
    1 - File (project settings)
    2 - Quick Help (documentation)
  4. Keyboard Flow:

    • Practice switching between inspectors without mouse
    • Combine with navigator shortcuts for full keyboard control
    • Use ⌥ ⌘ 0 as your "reset" button

These utilities become essential tools for efficient iOS development, especially when working with Interface Builder and storyboards!

👀 Viewing

  • ⌥ ⌘ Return - Show/hide SwiftUI Canvas
  • ⌥ ⌘ P - Refresh SwiftUI Preview
  • ⌃ ⌘ F - Enter/exit full screen
  • ⇧ ⌘ Y - Show/hide debug pane
  • ⌘ H - Hide Xcode
  • ⌘ , - Xcode Settings
  • ⌃ ⌘ ⇦ - Go back (File)

Real-world Scenarios

1. SwiftUI Development (⌥ ⌘ Return & ⌥ ⌘ P)

Scenario: Building a Social Media Feed

Project: Instagram Clone
Task: Creating custom feed post card

Workflow:
1. Write initial PostCard view structure
2. `⌥ ⌘ Return` to show Canvas
3. Make changes to layout
4. Preview looks stale
5. `⌥ ⌘ P` to refresh
6. Iterate design
7. Test dark/light mode
8. Preview different device sizes

Another Scenario: Design System Development

Project: Design System Library
Task: Creating reusable components

Process:
1. Working on ButtonStyles
2. `⌥ ⌘ Return` to open preview
3. Modify padding values
4. `⌥ ⌘ P` to see changes
5. Test different states
6. Add new color scheme
7. `⌥ ⌘ P` to refresh preview

2. Full Screen Mode (⌃ ⌘ F)

Scenario: Complex Debugging Session

Project: Video Streaming App
Task: Debug video playback issue

Steps:
1. `⌃ ⌘ F` to enter full screen
2. Maximize code visibility
3. Open multiple related files
4. Split screen for comparison
5. Debug video player class
6. `⌃ ⌘ F` to exit when done

3. Debug Pane (⇧ ⌘ Y)

Scenario: Performance Optimization

Project: Fitness Tracking App
Task: Optimize battery usage

Debug workflow:
1. Run app in simulator
2. `⇧ ⌘ Y` to show debug pane
3. Monitor CPU usage
4. Check memory allocation
5. Identify memory leaks
6. Hide pane when not needed

4. Hide Xcode (⌘ H)

Scenario: Multi-tasking

Situation: Client Meeting
Actions:
1. Quick `⌘ H` to hide Xcode
2. Show presentation
3. Take notes
4. `⌘ Tab` back to Xcode
5. Continue development

5. Xcode Settings (⌘ ,)

Scenario: New Team Member Onboarding

Task: Setting up development environment

Configuration:
1. `⌘ ,` to open settings
2. Configure text editor
   - Font size
   - Theme
   - Key bindings
3. Set up source control
4. Configure custom behaviors
5. Set up documentation

6. Navigation History (⌃ ⌘ ⇦)

Scenario: Code Review

Project: E-commerce App
Task: Review PR changes

Navigation:
1. Check CartViewController
2. Move to PaymentService
3. `⌃ ⌘ ⇦` to go back to Cart
4. Check CheckoutManager
5. `⌃ ⌘ ⇦` twice to review previous files

Advanced Usage Patterns

1. SwiftUI Preview Workflow

Efficient development cycle:
1. Write code
2. `⌥ ⌘ Return` (show preview)
3. Make changes
4. `⌥ ⌘ P` (refresh)
5. Repeat

2. Debug Session Pattern

Debug workflow:
1. `⌃ ⌘ F` (full screen)
2. `⇧ ⌘ Y` (show debug)
3. Run app
4. Monitor issues
5. Fix problems
6. `⇧ ⌘ Y` (hide debug)

3. Multi-window Development

Complex feature workflow:
1. Main window (full code)
2. Second window (preview)
3. `⌘ H` for quick switches
4. `⌃ ⌘ F` when needed

Pro Tips

  1. Preview Efficiency:
- Keep preview open for UI work
- Regular refreshes (`⌥ ⌘ P`)
- Multiple previews for different states
  1. Debug Strategy:
- Show debug pane only when needed
- Combine with console logging
- Use with breakpoints effectively
  1. Navigation Mastery:
- Use `⌃ ⌘ ⇦` for quick file hopping
- Combine with tab navigation
- Create efficient workflow patterns
  1. Settings Management:
- Regular settings backup
- Custom key bindings
- Shared team configurations

📁 File

  • ⌘ N - New file
  • ⇧ ⌘ N - New project

✏️ Editing

  • ⌘ ⇦ - Jump to beginning of line
  • ⌥ ⇦ - Jump to beginning of word
  • ⇧ ⌘ ⇦ - Select to beginning of line
  • ⌘ A - Select All
  • ⌃ I - Indent code
  • ⌘ / - Comment/uncomment
  • ⌥ ⌘ / - Method documentation
  • ⌘ + - Zoom in
  • ⌘ - - Zoom out
  • ⌃ ⌘ 0 - Reset zoom
  • ⌥ ⌘ [ - Move line up
  • ⌥ ⌘ ⇦ - Code folding
  • ⇧ ⌘ A - Show Code Actions
  • ⌃ ⌥ ⌘ F - Fix All Issues

File and Editing Shortcuts: Real-world Scenarios

File Operations

  • ⌘ N - New file
  • ⇧ ⌘ N - New project

File Operation Scenarios

1. Starting New Project

Scenario: Creating a Fitness App

Steps:
1. `⇧ ⌘ N` to create new project
2. Select iOS App template
3. Configure:
   - Product name: "FitnessPro"
   - Organization: "HealthTech Inc"
   - Bundle identifier
   - Language: Swift
   - Interface: SwiftUI

2. Adding New Files

Scenario: Building E-commerce App

Adding core features:
1. `⌘ N` - Create CartManager.swift
2. `⌘ N` - Create ProductModel.swift
3. `⌘ N` - Create CheckoutView.swift
4. `⌘ N` - Create UserProfile.swift

Editing Operations

1. Text Navigation and Selection

// Scenario: Refactoring Payment Processing Code

class PaymentProcessor {
    // Use `⌘ ⇦` to jump to line start
    func processPayment(amount: Double) {
        // Use `⌥ ⇦` to jump between words
        let taxAmount = calculateTax(amount)

        // Use `⇧ ⌘ ⇦` to select entire line
        let totalAmount = amount + taxAmount
    }
}

2. Code Organization

Scenario: Code Review Clean-up

// Use `⌃ I` to fix indentation
func messyFunction() {
        let x = 5
    print(x)
            return
}

// Use `⌘ /` to comment/uncomment code blocks
// func deprecatedMethod() {
//     // old implementation
// }

// Use `⌥ ⌘ /` for documentation
/// Processes user payment
/// - Parameters:
///   - amount: Payment amount
///   - currency: Payment currency
func processPayment(amount: Double, currency: String)

3. Code Visibility

Scenario: Working on Large View Controller

Workflow:
1. `⌘ +` zoom in for detailed work
2. `⌘ -` zoom out for overview
3. `⌃ ⌘ 0` reset when sharing screen
4. `⌥ ⌘ ⇦` fold large code blocks

4. Code Organization

Scenario: Refactoring TableView

// Use `⌥ ⌘ [` to reorder methods
class RestaurantViewController: UITableViewController {
    func setupUI() { }
    func configureCell() { }  // Move this up
    func loadData() { }
}

// Use `⇧ ⌘ A` for quick fixes
var image: UIImage? // Shows fix for force unwrap

1. Feature Development Workflow

Starting new feature:
1. `⇧ ⌘ N` - Create feature branch project
2. `⌘ N` - Create main feature file
3. `⌘ N` - Create supporting files
4. Use editing shortcuts for implementation
5. `⌃ ⌥ ⌘ F` - Final cleanup

2. Code Review Process

Review workflow:
1. `⌥ ⌘ ⇦` - Fold irrelevant code
2. `⌃ I` - Fix indentation issues
3. `⌘ /` - Comment out problematic code
4. `⌥ ⌘ /` - Add missing documentation
5. `⇧ ⌘ A` - Apply suggested fixes

3. Large File Navigation

Working with large files:
1. `⌘ ⇦` - Quick line navigation
2. `⌥ ⌘ ⇦` - Fold complex methods
3. `⌘ +/-` - Adjust visibility
4. `⌥ ⌘ [` - Organize methods

Pro Tips

1. File Creation Patterns

Efficient file creation:
1. Models: `⌘ N` → Swift File → ModelName
2. Views: `⌘ N` → SwiftUI View → ViewName
3. Controllers: `⌘ N` → Cocoa Touch Class

2. Editing Efficiency

Quick edits:
- Use `⌘ A` + `⌃ I` for full file indent
- Combine `⇧ ⌘ ⇦` with `⌘ /` for line comments
- Use `⌥ ⌘ /` before every public method

3. Code Organization Strategy

Regular maintenance:
1. `⌃ ⌥ ⌘ F` - Fix issues
2. `⌃ I` - Format code
3. `⌥ ⌘ /` - Update docs
4. `⌥ ⌘ ⇦` - Organize sections

4. Navigation Memory Tricks

Remember as workflows:
- Text movement: `⌘ ⇦`, `⌥ ⇦`
- Selection: add `⇧` to movement
- Organization: `⌃ I`, `⌘ /`
- Visibility: `⌘ +/-`, `⌃ ⌘ 0`

🔍 Navigation

  • ⇧ ⌘ J - Reveal in Project Navigator
  • ⌘ J - Move focus to editor
  • ⇧ ⌘ O - Open quickly
  • ⌃ ⌘ ⇦ - Go back (previous file)

🚀 Product Menu

  • ⌘ B - Build project
  • ⌘ R - Run project
  • ⇧ ⌘ K - Clean project
  • ⌘ . - Stop project running

🐛 Debug

  • ⌘ Y - Deactivate breakpoints
  • ⌘ \ - Add/delete breakpoint

🔎 Search

  • ⇧ ⌘ F - Search project
  • ⌘ F - Search file
  • ⌘ G - Find next
  • ⌃ ⇧ ⌘ H - Find call hierarchy

📱 Simulator

  • ⌘ S - New screen shot
  • ⌃ ⌘ Z - Simulate shake
  • ⇧ ⌘ H - Home
  • ⌘ K - Toggle keyboard
  • ⌘ ⇦ - Rotate simulator left

🔍 Navigation Scenarios

1. Complex Project Navigation

Scenario: Large E-commerce App

Task: Find and modify payment flow
1. `⇧ ⌘ O` - Quick open PaymentViewController
2. `⇧ ⌘ J` - Reveal file location
3. `⌘ J` - Focus on editor
4. `⌃ ⌘ ⇦` - Navigate between related files

2. Quick File Switching

Scenario: Debug User Authentication

Workflow:
1. `⇧ ⌘ O` type "Auth" - Find AuthManager
2. Check implementation
3. `⌃ ⌘ ⇦` - Go back to previous file
4. `⌘ J` - Focus on code

🚀 Product Menu Scenarios

1. Development Cycle

Scenario: New Feature Implementation

Feature: In-App Purchase
Steps:
1. Write code
2. `⌘ B` - Build to check errors
3. Fix issues
4. `⌘ R` - Run to test
5. `⌘ .` - Stop if issues found
6. `⇧ ⌘ K` - Clean if weird behaviors

2. Build Issues

Scenario: Mysterious Build Errors

Debug workflow:
1. `⇧ ⌘ K` - Clean project
2. `⌘ B` - Rebuild
3. Fix errors
4. `⌘ R` - Test changes

🐛 Debug Scenarios

1. Memory Leak Investigation

Scenario: App Memory Issues

Debug process:
1. `⌘ \` - Set breakpoints at init/deinit
2. `⌘ R` - Run app
3. `⌘ Y` - Toggle breakpoints as needed
4. Navigate through suspicious flows
5. Check memory graph

2. Complex Flow Debugging

Scenario: Payment Processing Bug

Steps:
1. `⌘ \` - Set breakpoints in payment flow
2. Start transaction
3. `⌘ Y` - Temporarily disable breakpoints
4. Check variables at each step

🔎 Search Scenarios

1. Code Refactoring

Scenario: Renaming API Endpoints

Process:
1. `⇧ ⌘ F` - Search all API strings
2. `⌘ F` - Search within files
3. `⌘ G` - Navigate through occurrences
4. `⌃ ⇧ ⌘ H` - Check usage hierarchy

2. API Usage Audit

Scenario: Deprecated Method Cleanup

Steps:
1. `⇧ ⌘ F` - Find all instances
2. `⌃ ⇧ ⌘ H` - Check call hierarchy
3. Review each usage
4. Update implementations

📱 Simulator Scenarios

1. App Store Screenshots

Scenario: Marketing Material Preparation

Process:
1. Navigate to key screens
2. `⌘ ⇦` - Rotate for landscape shots
3. `⌘ S` - Capture screenshots
4. `⇧ ⌘ H` - Return to home
5. Repeat for all features

2. Motion Testing

Scenario: Fitness App Development

Testing workflow:
1. Start workout
2. `⌃ ⌘ Z` - Simulate motion
3. Check tracking accuracy
4. `⌘ K` - Show keyboard for input

Combined Workflow Examples

1. Feature Development

Complete cycle:
1. `⇧ ⌘ O` - Open relevant files
2. Implement feature
3. `⌘ B` - Build check
4. `⌘ R` - Run test
5. `⌘ \` - Set debug points
6. Test thoroughly
7. `⌘ S` - Capture proof

2. Bug Investigation

Debug process:
1. `⇧ ⌘ F` - Search error message
2. `⌃ ⇧ ⌘ H` - Check call stack
3. `⌘ \` - Set breakpoints
4. `⌘ R` - Run debug
5. `⌘ Y` - Toggle breakpoints

Pro Tips

1. Navigation Efficiency

Quick moves:
- Combine `⇧ ⌘ O` with partial typing
- Use `⌃ ⌘ ⇦` for quick backs
- Keep `⌘ J` for focus control

2. Debug Strategy

Smart debugging:
- Strategic breakpoint placement
- Toggle with `⌘ Y` for speed
- Use call hierarchy for context

3. Search Mastery

Search workflow:
1. Start broad (`⇧ ⌘ F`)
2. Narrow down (`⌘ F`)
3. Navigate results (`⌘ G`)
4. Check usage (`⌃ ⇧ ⌘ H`)

4. Simulator Efficiency

Testing flow:
- Regular screenshot documentation
- Quick rotation checks
- Keyboard toggle for form testing