Kotlin Multiplatform Academy · レッスン

両チーム向けにAPIをドキュメント化する

AndroidとiOSの開発者が使い方を共有できるようKDocを書きます

レッスン 4/413 ステップ

「両チーム向けにAPIをドキュメント化する」はCoddyKit上の無料Kotlin Multiplatform Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これは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. 🎉

無料で開始

AI チューターと学ぶ Kotlin — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
30
レッスン
120

よくある質問

「両チーム向けにAPIをドキュメント化する」レッスンは無料ですか?

はい。「両チーム向けにAPIをドキュメント化する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Kotlin Multiplatform Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Kotlin Multiplatform Academyコースには全4レッスンが含まれています。

「両チーム向けにAPIをドキュメント化する」で何を学びますか?

AndroidとiOSの開発者が使い方を共有できるようKDocを書きます ブラウザで直接実行するハンズオンコードでKotlin Multiplatform Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Kotlin Multiplatform Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのKotlin Multiplatform Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「両チーム向けにAPIをドキュメント化する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このKotlin Multiplatform Academyレッスンでコードを書いて実行できますか?

はい。すべてのKotlin Multiplatform Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 小さなPublic APIを設計する
  2. internalとpublicのVisibility
  3. モジュール内のPackageを整理する
  4. 両チーム向けにAPIをドキュメント化する
← Kotlin Multiplatform Academyに戻る