0Pricing
Kotlin Multiplatform Academy · درس

توثيق API للفريقين

كتابة KDoc كي يتفق مطورو Android وiOS على طريقة الاستخدام

توثيق API للفريقين درس مجاني في Kotlin Multiplatform Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Kotlin Multiplatform Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Docs Are Part of the API

Both Android and iOS devs call your shared code, so clear documentation is as important as the functions themselves. 📝

Meet KDoc

KDoc is Kotlin's documentation comment. You write it right above a declaration, and tools turn it into readable reference pages.

/** Returns a friendly greeting for [name]. */
fun greet(name: String) = "Hi, " + name

Explain the Why

Code shows what happens; good docs explain the why and the intended use. State what a caller should expect, not how it works inside.

Document Parameters

Use the @param tag to describe each input. Callers from both apps then know exactly what to pass without reading the source.

/**
 * @param rate tax rate as a fraction, like 0.2
 */

Document Return Values

The @return tag describes what comes back. A clear return note prevents wrong assumptions about units, ranges, or null.

/** @return total price including tax, never negative */

Link With Brackets

Wrap names in square brackets to create links, like [Quote]. Readers jump straight to related types in the generated docs.

/** Builds a [Quote] from a base price. */

Show a Usage Sample

A tiny example beats paragraphs of prose. One snippet showing a real call answers most questions before they are asked.

Document Only the Public API

Spend your effort on the public surface. Internal helpers can stay lightly commented since no outside team will call them.

Mind the iOS Reader

Swift developers read your KDoc too, so describe behavior in plain terms. Avoid JVM jargon that means nothing on the iOS side.

Generate Docs With Dokka

Dokka reads your KDoc and produces a browsable site. Both teams get one shared reference instead of guessing from the code.

Keep Docs in Sync

Outdated docs mislead more than no docs. Update the KDoc in the same change as the code so the two never drift apart.

Quick Check

Let's check your documentation know-how.

Recap

Write KDoc on your public API, explain the why, tag params and returns, add a sample, and let Dokka share it with both teams. 🎉

الأسئلة الشائعة

هل درس «توثيق API للفريقين» مجاني؟

نعم — نص درس «توثيق API للفريقين» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Kotlin Multiplatform Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.

ماذا ستتعلم في «توثيق API للفريقين»؟

كتابة KDoc كي يتفق مطورو Android وiOS على طريقة الاستخدام تتمرن على Kotlin Multiplatform Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Kotlin Multiplatform Academy؟

لا تُشترط خبرة سابقة. Kotlin Multiplatform Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «توثيق API للفريقين»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Kotlin Multiplatform Academy هذا؟

نعم. كل درس في Kotlin Multiplatform Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. تصميم API عامة صغيرة
  2. رؤية internal مقابل public
  3. تنظيم الحزم داخل الوحدة
  4. توثيق API للفريقين
← العودة إلى Kotlin Multiplatform Academy