| name | codex-mobile |
| description | Codex 行動端 Use Case 技能。涵蓋 iOS/macOS 原生應用開發、 SwiftUI 架構、CLI 優先工作流。觸發條件:當需要使用 Codex 建構 iOS 或 macOS 原生應用、設定 Swift 專案時啟用。
|
Mobile — Codex Use Cases Skill
概述
Mobile 分類專注於使用 Codex 建構原生 iOS 和 macOS 應用。
核心特色是 CLI-first approach — 不依賴 Xcode GUI,
透過命令列工具完成專案建構與驗證。
本分類包含 1 個 use case:
- native-ios-macos-apps — 使用 CLI-first 方式建構 SwiftUI 應用
Use Case: Build for iOS and macOS
工作流程
| 步驟 | 動作 | 說明 |
|---|
| 1 | 選擇專案工具 | Tuist(推薦)或 xcodebuild |
| 2 | 搭建專案結構 | App entry point + targets |
| 3 | 設定 SwiftUI | @main App + WindowGroup |
| 4 | 建立 Navigation | NavigationStack / SplitView |
| 5 | 實作核心 Views | 主頁 + 詳情 + 設定 |
| 6 | 配置 Build Settings | 簽名、target platform |
| 7 | XcodeBuildMCP 驗證 | 建構零錯誤零警告 |
推薦 Prompt
Role: You are a senior iOS/macOS developer specializing in SwiftUI.
Context: Building a {{app_type}} app for {{target_platforms}}.
Task:
1. Scaffold the project:
- Use Tuist (preferred) or xcodebuild for project generation.
- Target: {{target_platforms}} with SwiftUI App protocol.
- Minimum deployment target: iOS 17 / macOS 14.
2. Set up architecture:
- Entry point: @main App struct with WindowGroup.
- Navigation: NavigationStack (iOS) / NavigationSplitView (macOS).
- State management: @Observable pattern (not @ObservedObject).
3. Create core views:
- Main content view with navigation.
- At least one detail view with data binding.
- Settings/Preferences view.
4. Configure build settings:
- Enable strict concurrency checking.
- Set up code signing for development.
5. Validate with XcodeBuildMCP — build must succeed with zero warnings.
Constraints:
- Use Swift 5.9+ features (macros, parameter packs where appropriate).
- Follow Apple HIG for platform-specific patterns.
- No UIKit/AppKit unless SwiftUI lacks the capability.
- Use async/await for all asynchronous operations.
Output Format:
- Complete Xcode project buildable from CLI.
- `README.md` with build instructions and architecture overview.
- Zero warnings on `xcodebuild build`.
Self-Verification:
Run xcodebuild for both iOS simulator and macOS targets.
Confirm zero build errors and zero warnings.
9 大 Codex 技能(官方建議)
Codex 針對 iOS/macOS 開發提供 9 種專用技能:
- apple-docs — Apple 文件查閱
- xcode-build — Xcode 建構(透過 XcodeBuildMCP)
- swift-package — Swift Package Manager 管理
- swiftui-patterns — SwiftUI 架構模式
- ios-testing — iOS 測試策略
- accessibility — 可及性合規
- performance — 效能分析與優化
- localization — 多國語言支持
- app-store — App Store 提交準備
AGENTS.md 配置
# iOS/macOS Development Conventions
## Build
- `tuist generate` then `xcodebuild build`
- Or: `swift build` for SPM-only projects
## Architecture
- SwiftUI-first, UIKit/AppKit only when necessary
- @Observable for state management (not @ObservedObject)
- NavigationStack (iOS) / NavigationSplitView (macOS)
- MVVM or MV pattern
## Conventions
- Minimum: iOS 17, macOS 14, Swift 5.9
- Enable strict concurrency checking
- Async/await for all async operations
- Follow Apple Human Interface Guidelines
Tips & 注意事項
- CLI-first: Codex 在無 GUI 環境運行,必須透過命令列建構
- XcodeBuildMCP: 這是 Codex 驗證 builds 的核心工具,確保已安裝
- Tuist vs xcodebuild: Tuist 更適合管理複雜專案結構
- SwiftUI 限制: 某些 UIKit 功能在 SwiftUI 中尚無對應,需標注
- @Observable: iOS 17+ 的新 pattern,比 @ObservedObject 更簡潔
平台特化設計
| 功能 | iOS | macOS |
|---|
| Navigation | NavigationStack | NavigationSplitView |
| Window | 單 window | 多 window 支持 |
| Input | Touch | Mouse + Keyboard |
| 快捷鍵 | 無 | Cmd+key |
| Menu Bar | 無 | 需自訂 |
常見問題
Q: 是否支持 visionOS?
官方 use case 主要覆蓋 iOS 和 macOS,但 SwiftUI 本身支持 visionOS。
可以在 deployment target 中加入。
Q: 能用 UIKit/AppKit 嗎?
可以,但僅在 SwiftUI 缺少該功能時使用。需在程式碼中標注原因。
Q: 如何處理 code signing?
開發階段使用 automatic signing。
Codex 環境可能需要設定 provisioning profile。
技術棧速查
| 技術 | 版本 | 用途 |
|---|
| Swift | 5.9+ | 程式語言 |
| SwiftUI | iOS 17+ | UI 框架 |
| Tuist | Latest | 專案管理 |
| XcodeBuildMCP | Latest | 建構驗證 |
| SPM | Built-in | 依賴管理 |