用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill watchos-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
基于 SOC 职业分类
正在显示 SKILL.md
| name | watchos-patterns |
| description | watchOS Patterns: Digital Crown, complications, glances, Haptic feedback, background tasks. |
| triggers | {"extensions":[".swift"],"directories":["watchos/","watch/","applewatch/"],"keywords":["watchos","apple watch","crown","complication","haptic","wkinterfacerunner","siri intent"]} |
| auto_load_when | Building Apple Watch apps or watchOS complications |
| agent | swift-developer |
| tools | ["Read","Write","Bash"] |
Focus: Watch-specific UI, sensors, complications, background tasks
Watch-Specific UI:
├── WKInterfaceObject subclasses
│ ├── WKInterfaceGroup - container
│ ├── WKInterfaceSeparator - divider
│ ├── WKInterfaceTimer - countdown
│ └── WKInterfaceImage - animated images
│
├── Digital Crown
│ └── CrownSequencer for scroll
│ └── picker style .sequence
│
├── Haptic Feedback
│ └── WKInterfaceDevice.current().play(.click)
│ └── .success, .warning, .error, .directionUp/Down
│
└── Context Menu
└── .contextMenu {} for long press
Layout on Watch:
├── WKHostingController for SwiftUI
│ └── import WatchKit
│ └── class InterfaceController: WKHostingController<Content>
│
├── Size Classes
│ └── .horizontalSizeClass == .compact
│ └── .verticalSizeClass == .compact
│
├── Automatic Table
│ └── Use Group for non-scrolling layouts
│ └── UseWKInterfaceTable for lists
│
└── Corner Radius
└── Watch has rounded corners
└── Use .clipShape(RoundedRectangle(cornerRadius: 8))
Complication Types:
├── CLKComplication
│ ├── .circularSmall, .circularMedium, .circularLarge
│ ├── .modularSmall, .modularLarge
│ ├── .utilitarianSmall, .utilitarianLarge
│ └── .graphic (watchOS 7+)
│
├── Timeline Provider
│ └── func getTimeline() async -> Timeline<Entry>
│ └──func getPlaceholder() -> ComplicationBundle
│
└── Background Refresh
└── Schedule timeline updates
└── BackgroundTasks framework
Phone ↔ Watch Communication:
├── WCSession
│ └── session: WCSession = .default
│ └── sendMessage(_:replyHandler:) for immediate
│ └── transferUserInfo() for guaranteed
│
├── WatchKit Extension Delegate
│ └── applicationDidEnterBackground()
│ └── handle(_:) for Siri intents
│
└── Parent Application
└── openURL() to launch iOS app
└── iOS handles complex processing
Background Refresh:
├── WKBackgroundTaskScheduler
│ └── registerForBackgroundTasks()
│
├── Types
│ ├── WKApplicationRefreshBackgroundTask
│ ├── WKWatchConnectivityRefreshBackgroundTask
│ └── WKSnapshotBackgroundTask
│
└── Schedule
└── BGTaskScheduler.shared.submit()
└── Keep background tasks under 30 seconds
❌ Full-screen scrolling lists — slow on small screen
✅ Use pagination, show limited items
❌ No haptic feedback — user can't feel success/error
✅ Play haptics: .success on completion, .error on failure
❌ Large tap targets — watch screen is tiny
✅ Keep tappable areas at least 44pt
❌ Complex gestures — hard to do on wrist
✅ Prefer taps, Digital Crown for lists only
❌ Not handling glance state — user sees stale data
✅ Use WKSnapshotBackgroundTask for glance updates
| Feature | API | Note |
|---|---|---|
| Layout | SwiftUI on Watch | Same as iOS |
| Navigation | NavigationStack | iOS 16+ pattern |
| Table | WKInterfaceTable | Legacy WatchKit |
| Haptic | WKInterfaceDevice | .play(.click) |
| Crown | CrownSequencer | Scrolling |
| Background | BGTaskScheduler | < 30 sec |
| Complication | CLKComplicationProvider | Timeline |