Community程式設計與開發github.com

dimillian/macos-spm-app-packaging

建立、建置與封裝基於 SwiftPM 的 macOS 應用程式,無需 Xcode 專案。適用於需要從頭建立 macOS 應用佈局、SwiftPM 目標/資源、自訂 .app 套件組合腳本,或是在 Xcode 外部進行簽署、公證與 appcast 步驟的情境。

macos-spm-app-packaging 是什麼?

這個技能提供一個完整的解決方案,用於建立、建置與封裝基於 SwiftPM 的 macOS 應用程式,完全不需要 Xcode 專案。它支援 macOS 應用程式的完整生命週期,從 scaffold 到 final packaging,包括自訂的 .app 套件組合腳本、簽署、公證與 appcast 步驟。此技能特別適用於開發者需要從頭建立 macOS 應用佈局、管理 SwiftPM 目標與資源,或者需要在 Xcode 外部進行進階封裝與部署流程的情境。它支援所有主要平台,包括 macOS 本身,並能透過程式碼與 CLI 命令進行自動化操作。技能的核心是一個自訂的 shell 腳本,用於組裝 .app 套件組合,並與 SwiftPM 的建置指令緊密整合。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/dimillian/skills/tree/main/skills/macos-spm-app-packaging

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

macos-spm-app-packaging 是做什麼的?

建立、建置與封裝基於 SwiftPM 的 macOS 應用程式,無需 Xcode 專案。適用於需要從頭建立 macOS 應用佈局、SwiftPM 目標/資源、自訂 .app 套件組合腳本,或是在 Xcode 外部進行簽署、公證與 appcast 步驟的情境。

概覽

此技能提供一個完整的解決方案,用於透過 Swift 套件管理器 (SwiftPM) 從頭建立 macOS 應用程式,避免對 Xcode 專案的依賴。它自動化以下任務:

  • Scaffolding 一個基本的 macOS 應用程式佈局
  • 設定 SwiftPM 目標與資源
  • 建立與組裝一個自訂的 .app 套件組合
  • 對應用程式進行簽署與公證
  • 產生 appcast 更新資訊

需求

  • Swift 5.5+ 與 SwiftPM 已安裝
  • macOS 11+ 或更新版本用於本機開發
  • 可選的 Apple Developer 帳戶 用於簽署與公證

用法

  1. Scaffold 應用程式: 使用提供的指令建立一個新的 macOS 應用專案。

    swift package init --type executable
    
  2. 建置: 使用 SwiftPM 建置專案。

    swift build -c release
    
  3. 封裝: 執行自訂腳本,將建置好的二進位檔組裝成 .app 套件組合。

    ./scripts/package.sh
    
  4. 簽署與公證: 對應用程式進行簽署,並提交給 Apple 公證。

    codesign --force --deep --sign "Developer ID Application" MyApp.app
    xcrun notarytool submit MyApp.zip --apple-id <APPLE_ID> --team-id <TEAM_ID> --password <PASSWORD>
    
  5. Appcast: 產生一個 appcast XML 檔案,以便與 Sparkle 整合。

支援的平台

  • macOS(主要目標)
  • 所有 Swift 支援的平台(用於非 GUI 部分)

工作原理

技能的核心是一個 shell 腳本,用於將 SwiftPM 建置輸出組裝成一個標準的 .app 套件組合。它會:

  1. 複製可執行檔到 MyApp.app/Contents/MacOS/
  2. 複製資源到 MyApp.app/Contents/Resources/
  3. 產生 Info.plist(如果未提供)
  4. 對二進位檔進行簽署(如果提供了簽署身份)
  5. 提供可選的 dmg 封裝 ZIP 功能

這個腳本會自動處理 SwiftPM 的相依性,並確保套件組合符合 macOS 的標準。

範例

# Scaffold 一個新的應用程式
swift package init --type executable

# 建置應用程式
swift build -c release

# 封裝應用程式
./scripts/package.sh

額外資源

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

dimillian/app-store-changelog

Create user-facing App Store release notes by collecting and summarizing all user-impacting changes since the last git tag (or a specified ref). Use when asked to generate a comprehensive release changelog, App Store "What's New" text, or release notes based on git history or tags.

dimillian/ios-debugger-agent

Use XcodeBuildMCP to build, run, launch, and debug the current iOS project on a booted simulator. Trigger when asked to run an iOS app, interact with the simulator UI, inspect on-screen state, capture logs/console output, or diagnose runtime behavior using XcodeBuildMCP tools.

dimillian/swift-concurrency-expert

Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file. Concrete actions include adding Sendable conformance, applying @MainActor annotations, resolving actor isolation warnings, fixing data race diagnostics, and migrating completion handlers to async/await.

dimillian/swiftui-liquid-glass

Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.

dimillian/swiftui-performance-audit

Audit and improve SwiftUI runtime performance from code review and architecture. Use for requests to diagnose slow rendering, janky scrolling, high CPU/memory usage, excessive view updates, or layout thrash in SwiftUI apps, and to provide guidance for user-run Instruments profiling when code review alone is insufficient.

dimillian/swiftui-ui-patterns

Best practices and example-driven guidance for building SwiftUI views and components, including navigation hierarchies, custom view modifiers, and responsive layouts with stacks and grids. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens with VStack/HStack, managing @State or @Binding, building declarative iOS interfaces, or needing component-specific patterns and examples.

dimillian/swiftui-view-refactor

Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage. Use when cleaning up a SwiftUI view, splitting long bodies, removing inline actions or side effects, reducing computed `some View` helpers, or standardizing `@Observable` and view model initialization patterns.

相關技能