Skillpedia
تطبيقات الجوال7.4k · #13248

swift-concurrency-expert

ما الذي تفعله

تشخّص هذه المهارة أخطاء المترجم المتعلقة بالتزامن في Swift، وتطبّق إصلاحات آمنة للممثلين والعزل على الخيط الرئيسي والبيانات المشتركة. وهي لمطوري تطبيقات Swift 6.

متى تستخدمها

  • ✓عندما يُظهر Swift أخطاء تتعلق بالممثلين أو العزل أو أنواع Sendable.
  • ✓عندما تحتاج إلى نقل العمل الخلفي خارج الخيط الرئيسي بأمان.
  • ✓عندما تريد مراجعة إعداد التزامن الحالي في تطبيق Swift.

رابط المهارة

https://github.com/steipete/agent-scripts/blob/main/skills/swift-concurrency-expert/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/steipete/agent-scripts/blob/main/skills/swift-concurrency-expert/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“يقول Xcode إن نموذج العرض لدي فيه خطأ Sendable. أصلحه بأصغر تغيير آمن.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يلتقط الوكيل رسالة المترجم بالضبط، ويجد إعداد الممثل الحالي، ثم يطبّق أصغر إصلاح يحافظ على السلوك نفسه. ويتجنب الاختصارات غير الآمنة إلا إذا أمكن إثبات سلامة الخيوط.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Swift Concurrency Expert

Attribution: copied from @Dimillian’s Dimillian/Skills (2025-12-31).

Overview

Review and fix Swift Concurrency issues in Swift 6.2+ codebases by applying actor isolation, Sendable safety, and modern concurrency patterns with minimal behavior changes.

Workflow

1. Triage the issue

  • Capture the exact compiler diagnostics and the offending symbol(s).
  • Identify the current actor context (@MainActor, actor, nonisolated) and whether a default actor isolation mode is enabled.
  • Confirm whether the code is UI-bound or intended to run off the main actor.

2. Apply the smallest safe fix

Prefer edits that preserve existing behavior while satisfying data-race safety.

Common fixes:

  • UI-bound types: annotate the type or relevant members with @MainActor.
  • Protocol conformance on main actor types: make the conformance isolated (e.g., extension Foo: @MainActor SomeProtocol).
  • Global/static state: protect with @MainActor or move into an actor.
  • Background work: move expensive work into a @concurrent async function on a nonisolated type or use an actor to guard mutable state.
  • Sendable errors: prefer immutable/value types; add Sendable conformance only when correct; avoid @unchecked Sendable unless you can prove thread safety.

Reference material

  • See references/swift-6-2-concurrency.md for Swift 6.2 changes, patterns, and examples.
  • See references/swiftui-concurrency-tour-wwdc.md for SwiftUI-specific concurrency guidance.
الأسئلة الشائعة

هل يغيّر طريقة عمل التطبيق؟

تسعى المهارة إلى أقل تغيير في السلوك مع الالتزام بقواعد سلامة سباق البيانات.

متى يُسمح بـ Sendable غير المفحوص؟

فقط عندما يمكن إثبات سلامة الخيوط، بحسب المهارة.

أي إصدارات Swift تستهدف؟

Swift 6.2 وما بعدها.

التفاصيل

الوصف الأصلي من المؤلف

Swift concurrency review/fix: compiler errors, Sendable, isolation, remediation.

repo: steipete/agent-scripts

الشعبية

نجوم GitHub
7.4k
الترتيب
#13248
الترخيص
MIT
آخر تحديث
30‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة