● مجتمع
twostraws
⚡ فوري
SwiftUI Agent Skill
بواسطة twostraws · twostraws/SwiftUI-Agent-Skill
Paul Hudson's SwiftUI patterns packaged as a Claude skill.
By Paul Hudson (Hacking with Swift), this skill teaches Claude modern SwiftUI: @Observable, NavigationStack, async views, proper state ownership. The result: SwiftUI code that actually compiles and follows Apple's current guidance.
لماذا تستخدمه
الميزات الأساسية
- iOS 17+ Observation framework (no more ObservableObject in new code)
- NavigationStack patterns with type-safe destinations
- Common pitfalls list (TextField + State race conditions, sheet vs popover)
- Accessibility annotations baked into examples
- Test-friendly view structure
عرض مباشر
كيف يبدو في الممارسة
swiftui-agent-skill.replay
▶ جاهز
حالات الاستخدام
استخدامات عملية: SwiftUI Agent Skill
متى تستخدمه: You want a Settings screen that's actually idiomatic for iOS 17+.
المتطلبات الأساسية
- Server/skill installed and authenticated — See repo README
الخطوات
-
Plan
Using the SwiftUI skill, design a Settings view with sections: Account, Notifications, About. Use @Observable for the view model.✓ تم النسخ
→ View hierarchy + ViewModel sketch
-
Code
Write the full file with toggles, NavigationLink to subpages, and a confirmation dialog for sign-out.✓ تم النسخ
→ Compiles on Xcode 15+
النتيجة: Idiomatic SwiftUI you don't have to rewrite next year.
المزالق
- Don't mix @StateObject with @Observable — Don't mix @StateObject with @Observable — the skill enforces one or the other; follow it.
التكلفة والحدود
تكلفة التشغيل
- حصة API
- See provider docs for rate limits
- الرموز لكل استدعاء
- Varies by tool
- التكلفة المالية
- See repo README for pricing details
- نصيحة
- Cache tool results and avoid repeated identical calls.
الأمان
الصلاحيات والأسرار ونطاق الأثر
تخزين بيانات الاعتماد: Use environment variables; never commit secrets
نقل البيانات الخارجي: Tool calls go to the provider's API as documented
استكشاف الأخطاء
الأخطاء الشائعة وحلولها
view doesn't update on state change
Ensure the property is on an @Observable class, not a struct. The skill's checklist covers this.
تحقق: @Observable annotation present
preview crashes
@Observable views need a real instance in #Preview. The skill's examples show the pattern.
تحقق: Preview compiles
البدائل
SwiftUI Agent Skill مقابل البدائل
| البديل | متى تستخدمها | المقايضة |
| wholiver/swiftui-design-skill | You want design direction, not code patterns | Design-focused; twostraws is code-focused |