用途:面向 macOS 原生应用开发,基于 AppKit 完成窗口、菜单、系统集成与分发。
主要能力:涵盖 AppKit 组件(NSWindow、NSViewController、NSView、NSMenu、NSStatusItem、NSAlert)、窗口类型(NSWindow、NSPanel、NSPopover、NSSavePanel/NSOpenPanel)以及分发方式(Mac App Store 需沙盒与审核;Developer ID 需公证;直接分发会被 Gatekeeper 拦截)。提供菜单栏应用、NSDocument 文档型应用、沙盒安全作用域书签、公证脚本等代码示例。
参数:distribution_method(app_store/developer_id/none,默认 developer_id)、sandbox_enabled(默认 true)、min_macos_version(默认 13.0)、app_type(document_based/single_window/menu_bar/agent,默认 single_window)。
用法:通过 Skill("swift-macos") 调用。前置条件为 macOS Sonoma+ 上的 Xcode 15+、Apple Developer 账号(分发用)及 AppKit 基础。
限制与排错:常见问题包括未公证导致“App is damaged”、缺少 entitlement 引发沙盒违规、激活策略错误导致窗口不显示、菜单缺少 target/action、Sparkle 更新签名问题。可用 codesign -dv --verbose=4、codesign -d --entitlements :-、spctl --assess --type execute 及 log show 排查。校验规则要求启用 hardened runtime、仅申请必要沙盒权限、使用 Developer ID 签名。相关技能:swift-swiftui、swift-architecture、swift-testing。