Xcode快捷Behavior

前言

在Xcode开发环境中,有一些可以自定义的快捷Behavior,可以大大提高开发效率。

如何配置Behavior

以下是在Xcode中配置Behavior的通用步骤:

  1. 打开Xcode的偏好设置。
  2. 点击"Behaviors"选项卡。
  3. 点击左下角的"+"号创建一个新的Behavior。
  4. 为Behavior命名,例如你希望调用的脚本名。
  5. 在"Run"下选择"Script",然后粘贴你的脚本。
  6. 按需配置快捷键,并保存。

现在,每当你使用配置的快捷键时,它就会运行你的脚本。

Behavior1:打开终端并cd到当前工作目录

创建open_terminal.sh,写入以下内容

bash 复制代码
#!/bin/bash
open -a terminal "`pwd`"

并添加执行权限

bash 复制代码
sudo chmod +x open_terminal.sh

添加Behavior并在Run处选中该脚本路径,配置好快捷键。 当你使用配置的快捷键时,就会打开终端并cd到当前工作目录

Behavior2:打开项目文件夹

创建open_project_folder.sh,写入以下内容

bash 复制代码
#!/bin/bash

# Path to your project
project_path="$1"

# Open the project folder in Finder
open "$project_path"

并添加执行权限

bash 复制代码
sudo chmod +x open_project_folder.sh

添加Behavior并在Run处选中该脚本路径,配置好快捷键。 当你使用配置的快捷键时,就会在Finder中打开你的项目文件夹

总结

通过配置Behavior,我们可以更快速地访问项目文件夹和命令行等,从而提高开发效率。自定义Behavior是Xcode强大功能的一个体现,它允许我们根据自己的需求调整开发环境。

相关推荐
2501_9159090619 小时前
Charles 抓不到包怎么办?iOS 调试过程中如何判断请求路径
android·ios·小程序·https·uni-app·iphone·webview
2501_9160074719 小时前
iOS和iPadOS文件管理系统全面解析与使用指南
android·ios·小程序·https·uni-app·iphone·webview
2501_915921431 天前
iOS App 开发阶段性能优化,观察 CPU、内存和日志变化
android·ios·性能优化·小程序·uni-app·iphone·webview
游戏开发爱好者81 天前
在 iOS 开发、测试与上架过程中 如何做证书管理
android·ios·小程序·https·uni-app·iphone·webview
ii_best1 天前
按键精灵安卓/IOS手机助手 × 手机按键 App:1 分钟搞定设备连接(超详细教程)
android·ios·智能手机·自动化·编辑器
2501_916007471 天前
在没有 Mac 的情况下完成 iOS 应用上架 App Store
android·macos·ios·小程序·uni-app·iphone·webview
TheNextByte11 天前
iPhone存储空间已满?如何轻松释放iPhone空间?
android·ios·iphone
—Qeyser1 天前
Flutter 颜色完全指南
android·flutter·ios
2501_916008891 天前
iOS 上架需要哪些准备,账号、Bundle ID、证书、描述文件、安装测试及上传
android·ios·小程序·https·uni-app·iphone·webview
Zender Han2 天前
Flutter Android 启动页 & App 图标替换(不使用任何插件的完整实践)
android·flutter·ios