Macos Menubar Tuist App

作者 dimillian05ba982bfeb0無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫6 個月前更新

Build, refactor, or review macOS menubar apps that use Tuist and SwiftUI. Use when creating or maintaining LSUIElement menubar utilities, defining Tuist targets/manifests, implementing model-client-store-view architecture, adding script-based launch flows, or validating reliable local build/run behavior without Xcode-first workflows.

AI 產生的概覽

指導建置、重構與審查使用 Tuist 與 SwiftUI 的 macOS 選單列應用程式。

功能
為使用 Tuist 與 SwiftUI 建置的純選單列 macOS 應用程式提供慣例與工作流程,涵蓋 LSUIElement 設定、Tuist 資訊清單,以及 model-client-store-view 架構。它定義了預期的檔案配置方式、啟動指令稿行為、建置與執行命令的驗證矩陣,以及常見失敗模式與修正方向。產出的是指引與檢查清單,而非程式碼成品。
適用情境
適用於建立或維護 LSUIElement 選單列工具、定義 Tuist 目標或資訊清單、實作 model-client-store-view 分層,或建立以指令稿為基礎的本機建置與啟動流程。也適合在審查此類應用程式的架構界線或本機執行不穩定問題時使用。
執行需求
未隨附指令稿,僅為指示文件。假定具備 macOS 環境,已安裝 Tuist 與 Xcode 命令列工具,並可使用 shell 執行啟動/停止指令稿,以及用 curl 探測後端端點。

macos-menubar-tuist-app

Build and maintain macOS menubar apps with a Tuist-first workflow and stable launch scripts. Preserve strict architecture boundaries so networking, state, and UI remain testable and predictable.

Core Rules

  • Keep the app menubar-only unless explicitly told otherwise. Use LSUIElement = true by default.
  • Keep transport and decoding logic outside views. Do not call networking from SwiftUI view bodies.
  • Keep state transitions in a store layer (@Observable or equivalent), not in row/view presentation code.
  • Keep model decoding resilient to API drift: optional fields, safe fallbacks, and defensive parsing.
  • Treat Tuist manifests as the source of truth. Do not rely on hand-edited generated Xcode artifacts.
  • Prefer script-based launch for local iteration when tuist run is unreliable for macOS target/device resolution.
  • Prefer tuist xcodebuild build over raw xcodebuild in local run scripts when building generated projects.

Expected File Shape

Use this placement by default:

  • Project.swift: app target, settings, resources, Info.plist keys
  • Sources/*Model*.swift: API/domain models and decoding
  • Sources/*Client*.swift: requests, response mapping, transport concerns
  • Sources/*Store*.swift: observable state, refresh policy, filtering, caching
  • Sources/*Menu*View*.swift: menu composition and top-level UI state
  • Sources/*Row*View*.swift: row rendering and lightweight interactions
  • run-menubar.sh: canonical local restart/build/launch path
  • stop-menubar.sh: explicit stop helper when needed

Workflow

  1. Confirm Tuist ownership
  • Verify Tuist.swift and Project.swift (or workspace manifests) exist.
  • Read existing run scripts before changing launch behavior.
  1. Probe backend behavior before coding assumptions
  • Use curl to verify endpoint shape, auth requirements, and pagination behavior.
  • If endpoint ignores limit/page, implement full-list handling with local trimming in the store.
  1. Implement layers from bottom to top
  • Define/adjust models first.
  • Add or update client request/decoding logic.
  • Update store refresh, filtering, and cache policy.
  • Wire views last.
  1. Keep app wiring minimal
  • Keep app entry focused on scene/menu wiring and dependency injection.
  • Avoid embedding business logic in App or menu scene declarations.
  1. Standardize launch ergonomics
  • Ensure run script restarts an existing instance before relaunching.
  • Ensure run script does not open Xcode as a side effect.
  • Use tuist generate --no-open when generation is required.
  • When the run script builds the generated project, prefer TUIST_SKIP_UPDATE_CHECK=1 tuist xcodebuild build ... instead of invoking raw xcodebuild directly.

Validation Matrix

Run validations after edits:

bash
TUIST_SKIP_UPDATE_CHECK=1 tuist xcodebuild build -scheme <TargetName> -configuration Debug

If launch workflow changed:

bash
./run-menubar.sh

If shell scripts changed:

bash
bash -n run-menubar.shbash -n stop-menubar.sh./run-menubar.sh

Failure Patterns and Fix Direction

  • tuist run cannot resolve the macOS destination: Use run/stop scripts as canonical local run path.

  • Menu UI is laggy or inconsistent after refresh: Move derived state and filtering into the store; keep views render-only.

  • API payload changes break decode: Relax model decoding with optional fields and defaults, then surface missing data safely in UI.

  • Feature asks for quick UI patch: Trace root cause in model/client/store before changing row/menu presentation.

Completion Checklist

  • Preserve menubar-only behavior unless explicitly changed.
  • Keep network and state logic out of SwiftUI view bodies.
  • Keep Tuist manifests and run scripts aligned with actual build/run flow.
  • Run the validation matrix for touched areas.
  • Report concrete commands run and outcomes.

來源與署名

來源:dimillian/skills位於macos-menubar-tuist-app提交05ba982

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架