Jacky's blog
首页
  • 学习笔记

    • web
    • android
    • iOS
    • vue
  • 分类
  • 标签
  • 归档
收藏
  • tool
  • algo
  • python
  • java
  • server
  • growth
  • frida
  • blog
  • SP
  • more
GitHub (opens new window)

Jack Yang

编程; 随笔
首页
  • 学习笔记

    • web
    • android
    • iOS
    • vue
  • 分类
  • 标签
  • 归档
收藏
  • tool
  • algo
  • python
  • java
  • server
  • growth
  • frida
  • blog
  • SP
  • more
GitHub (opens new window)
  • iOS 学习导航
  • 调研

  • other

    • iOS术语
    • swift语法
    • oc语法
    • 原理
    • 项目构建
    • Swift 开发最佳实践
    • pod
    • xcode的使用
      • 快捷键
        • 导航与搜索
        • Editor
        • 界面与面板
        • 构建与调试
        • iOS 模拟器快捷键
      • 其他
        • attach debug process
        • file blame
        • 查看派生类
      • 链接
  • 《iOS》
  • other
Jacky
2023-10-07
目录

xcode的使用

# 快捷键

# 导航与搜索

  • Command Shift - A: Quick Actions(快速操作面板)
  • Command Shift - O:Open Quickly,全局快速查找文件/符号(最常用)
  • Command Shift - F: Find in Workspace
  • Command Shift - J: 在左侧项目导航器(Project Navigator)中定位并高亮当前打开的文件
  • Command - L:跳转到指定行
  • Command Ctrl - J:跳转到符号定义/实现(索引未完成时比 Command - 点击 更可靠)
  • Command Ctrl - ↑ / Command Ctrl - ↓:切换 .h 头文件 / .m/.mm 实现文件
  • Command Ctrl - ← / Command Ctrl - →:前进/后退(导航历史)
  • Command - 点击:弹出上下文菜单,可查看 Callers(调用者) (opens new window)

# Editor

  • Command - [ / Command - ]:选中行向左/向右缩进
  • Command Option - [ / Command Option - ]:当前行向上/向下移动
  • Option - 点按:查看选中符号的 Quick Help 提示
  • Ctrl - 1:show releated items
  • Ctrl - 6:查看当前文件结构(方法/符号列表,可直接输入过滤)
  • 代码折叠
    • Command Option - ←:折叠当前代码块(方法、类、if/else 等)
    • Command Option - →:展开当前代码块
    • 鼠标操作:点击行号左侧的折叠箭头(▽ 展开 / ▷ 折叠)
    • Control Command - ↑:聚焦当前代码块(Focus),隐藏其他代码,专注当前方法
    • 折叠/展开所有:菜单栏 Editor → Code Folding → Fold / Unfold
  • 代码格式化
    • Ctrl - I:重新缩进(Re-Indent),格式化选中代码的缩进,或当前行。Xcode 原生只有重新缩进,不会自动调整空格/换行
    • Command - A → Ctrl - I:全选后重新缩进,格式化整个文件
    • 完整代码格式化(空格、换行、排序等)需使用第三方工具:
      • 命令行:swiftformat <文件或目录>(需先 brew install swiftformat)
      • Xcode 扩展:安装 SwiftFormat for Xcode 后,Editor → SwiftFormat → Format File
      • 可在 Settings → Key Bindings 中自定义格式化快捷键(如 Command Option - L,对齐 Android Studio)

# 界面与面板

  • Command - ,:打开偏好设置 → Key Bindings 可查看所有快捷键
  • Command - 0:显示/隐藏左侧 Navigator 面板
  • Command Shift - [ / Command Shift - ]:在已打开的 Tab 之间切换

# 构建与调试

  • Command - R:重新构建
  • Command Shift - K:Clean Build Folder

# iOS 模拟器快捷键

快捷键 功能
Command Shift - H 按一次 Home 键(返回桌面)
Command Shift - H(连按两次) 进入 App Switcher(应用切换器)
Command - L 锁定模拟器
Command - R 旋转屏幕
Command Shift - S 截图(保存到桌面)
Control Command - Z 模拟 Shake 手势(摇一摇)
Command - K 切换键盘显示/隐藏
Command - T 打开 Slow Animations(慢动作动画,调试动画用)

更多模拟器选项可在模拟器菜单栏 Hardware / Device / Features 中查看,快捷键会标注在菜单项右侧。

# 其他

# attach debug process (opens new window)

Attaching to a Running Process

You can use Xcode to attach to, and debug, a program that is already running. You can attach to a program running under Xcode or to any process running on the current computer for which you have a process ID. To attach the debugger to a running process perform one of the following operations:

  1. Choose a program from the Debug > Attach menu. This menu lists currently running programs launched from Xcode, identified by the program name and the name of the corresponding Xcode project. (This menu also lists other programs running on the system.) To attach to one of these programs, choose it from the menu.
  2. To attach to any other running process, choose Debug > Attach > Process ID. Enter the process ID of the process you want to attach to in the dialog that Xcode displays and press Return.
  3. Click the Attach toolbar item in the Run Log window to attach to a program already running in Xcode. Xcode automatically displays this window when you launch a program in Xcode.

When you launch a program from Xcode, you can also have Xcode automatically attempt to attach the debugger to the process when the program crashes. To do so, select the executable for the program, open an inspector, and select the ?Auto-attach debugger on crash? option in the Debugging pane.

# file blame

for a git blame version click Editor->Author as it, sure it moved

# 查看派生类

采取全局搜索的方式 : xxx

# 链接

  • xcode ddocumentation (opens new window)
  • 其他
    • XCode 使用一: Xcode 基本操作 (opens new window)
    • macOS 开发入门之一: 初识 Xcode (opens new window)
#iOS#guide
上次更新: 2026/09/10, 20:52:09
pod

← pod

最近更新
01
direnv
09-09
02
nvim
09-09
03
wget
09-09
更多文章>
Theme by Vdoing | Copyright © 2019-2026 Jacky | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式