Skip to content

Instantly share code, notes, and snippets.

gemini pro 系统指令

<system_instructions>

    <!-- =========================================================

       模块 1: 行为与沟通协议 (Behavior Layer)

       定义:AI 的人设与沟通底线

UIScrollView关键公式

  • 在AppDelegate中添加加载代码:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
//Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
//Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()

#sourcetree使用技巧

  • 查看文件的提交历史

选中文件右键 -> 查看选中的修改日志

git总结

git reset --mixed <commit>git reset --soft <commit>git reset --hard <commit>区别

MACOS技巧

允许任何来源

输入命令

sudo spctl --master-disable

然后打开系统设置 -> 隐私与安全性 -> 安全性下的允许以下来源的应用程序 -> 任何来源

git gerrit客户端配置

客户端配置

  • 安装 commit-msg hook,用于提交时生成Change-Id
curl -o .git/hooks/commit-msg \
  http://gerrit-server:8080/tools/hooks/commit-msg
chmod +x .git/hooks/commit-msg
  • 配置git review

swift语法注意事项:三元表达式

报错

print("\(text)】---\((result? "匹配": "不匹配"))")

不报错

print("\(text)】---\((result ? "匹配": "不匹配"))")

注意

iOS开发代码片段:view完全截图,包含子视图超出view的部分

extension UIView {
    func captureEntireView() -> UIImage? {
        // 计算包含所有子视图的完整边界
        let overallRect = calculateEntireBounds()
        
        UIGraphicsBeginImageContextWithOptions(overallRect.size, false, UIScreen.main.scale)
        defer { UIGraphicsEndImageContext() }

iOS开发调试:Chisel的使用

  • pvc:查看当前控制器状态
  • pviews:查看UIWindow及其子视图层级关系
  • presponder:打印一个对象的响应链关系
  • pclass:根据内存地址打印相关信息
  • visualize:使用mac系统preview程序查看UIImage、CGImage、UIView、CALayer、NSData(of an UIImage)、UIColor、CIColor。
  • show/hide:显示or隐藏一个UIView
  • mask/umask:给一个UIView或CALayer添加一个半透明蒙版
  • border/unborder:给指定的UIView或CALayer添加边框或移除边框用于调试,记得执行后紧接着执行caflush
  • caflush:刷新界面UI,类似于前面介绍的flush