Post

Essential VS Code Shortcuts for iOS Developers (Using Cursor or VS Code)

Boost your productivity in VS Code or Cursor with these must-know shortcuts for iOS development.

Essential VS Code Shortcuts for iOS Developers (Using Cursor or VS Code)

If you’re an iOS developer using VS Code (or Cursor, its AI-powered fork), mastering shortcuts can significantly boost your productivity. Whether you’re writing Swift code, documenting your work in Markdown, or managing your project via terminal, these shortcuts will help you work efficiently.


1. Command Palette & Quick Open

1.1 Command Palette

  • Shortcut: Cmd + Shift + P
  • Usage: Brings up the Command Palette, allowing you to:
    • Search for commands (e.g., “Markdown: Open Preview”).
    • Install and manage extensions.
    • Change settings, shortcuts, and more.

1.2 Quick Open

  • Shortcut: Cmd + P
  • Usage: Quickly open files in your project by typing their names. Great for large Swift projects.

2. Side Bar & Terminal Management

2.1 Toggle Side Bar

  • Shortcut: Cmd + B
  • Usage: Shows or hides the Explorer side panel for better screen real estate.

2.2 Toggle Integrated Terminal

  • Shortcut: Ctrl + `
  • Usage: Opens or closes the built-in terminal for running Swift commands, Git, or other tools.

3. Markdown Preview (For Blog Writing)

3.1 Open Markdown Preview

  • Shortcut: Cmd + Shift + V
  • Alternate: Cmd + Shift + P → “Markdown: Open Preview to the Side”
  • Usage: Opens a live preview of your .md file, useful for blog writing.

3.2 Side-by-Side Markdown Preview

  • Shortcut: Cmd + Shift + P → “Markdown: Open Preview to the Side”
  • Usage: Splits the view so you can see the Markdown source and rendered preview simultaneously.

4. Code Editing Efficiency

4.1 Multi-Cursor Editing

  • Shortcut: Option + Click (multiple places)
  • Usage: Allows you to edit multiple lines simultaneously—ideal for Swift code refactoring.

4.2 Format Code

  • Shortcut: Shift + Option + F
  • Usage: Auto-formats code (requires a formatter like SwiftFormat).

4.3 Commenting Code

  • Shortcut: Cmd + /
  • Usage: Toggles comments for selected lines in Swift or Markdown.

4.4 Go to Definition / Peek Definition

  • Go to Definition: F12 (or Cmd + Click)
  • Peek Definition: Option + F12
  • Usage: Quickly navigate Swift classes, methods, and variables.

5. Navigation & Views

5.1 Switching Between Open Files

  • Shortcut: Cmd + Shift + ] (next tab) / Cmd + Shift + [ (previous tab)

5.2 Open File Explorer

  • Shortcut: Cmd + Shift + E
  • Usage: Focuses the Explorer panel for quick file access.

5.3 Jump to Line

  • Shortcut: Ctrl + G + [line number]
  • Usage: Instantly jumps to a specific line.

6. Terminal Shortcuts

6.1 Create a New Terminal

  • Shortcut: Cmd + Shift + \
  • Usage: Opens a new terminal session inside VS Code.

6.2 Split Terminal

  • Shortcut: Cmd + Shift + 5
  • Usage: Splits the terminal window for running multiple commands (e.g., swift build in one, git status in another).

7. Extensions for iOS Development

While VS Code isn’t a replacement for xCode, it can be a great alternative for Swift development, especially for:

  • Swift Syntax Highlighting: Install Swift Language.
  • iOS Development: Install SweetPad.
  • Markdown Preview: Use built-in preview features or install Markdown extensions for better rendering.
  • GitLens: Advanced Git features like commit history, blame view, and file comparison.

7.1 Installing Extensions

  • Shortcut: Cmd + Shift + X
  • Usage: Opens the Extensions panel to install and manage plugins.

8. Debugging in VS Code (Swift & Server-Side Swift)

While Xcode remains the primary tool for iOS debugging, VS Code supports:

  • Swift Package Debugging: Using LLDB.
  • Server-Side Swift Debugging: Install CodeLLDB for debugging Swift projects.
  • Breakpoint Support: Limited but available for Swift and Markdown debugging.

9. Customizing Shortcuts

If a default shortcut doesn’t suit your workflow:

  1. Open Keyboard Shortcuts with Cmd + K, then Cmd + S.
  2. Search for the command.
  3. Assign a new shortcut.

Final Thoughts

  • Use the Command Palette (Cmd + Shift + P) often: If you forget a shortcut, start typing what you want to do.
  • Leverage multi-cursor editing: It’s a powerful way to edit Swift or Markdown efficiently.
  • Install the right extensions: Tailor VS Code to your iOS workflow.

By mastering these shortcuts, you can streamline your development and writing process, making VS Code (or Cursor) an even more powerful tool for iOS development. 🚀

This post is licensed under CC BY 4.0 by the author.