0Pricing
Kotlin Multiplatform Academy · レッスン

ArgumentsとDeep Linksを渡す

遷移先の間でデータを安全に渡します

「ArgumentsとDeep Linksを渡す」はCoddyKit上の無料Kotlin Multiplatform Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはKotlin Multiplatform Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Kotlin Multiplatform Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Screens Need Data

A details screen has to know which item to show. Arguments are how one screen tells the next exactly what to display. 📦

Put the Value in the Route

You declare a placeholder right inside the route string. Curly braces mark where a value will be slotted in.

composable("details/{itemId}") { entry ->
    DetailsScreen(entry)
}

Read the Argument

Inside the destination you pull the value from the back stack entry. It arrives as a string you can use right away.

val itemId = entry.arguments?.getString("itemId")

Pass a Value When Navigating

To send data you simply build the real route with your value inside it, then navigate to that string.

navController.navigate("details/42")

Type-Safe Arguments

You can declare an argument as an Int instead of a string, so the framework parses and validates it for you.

composable(
    "details/{itemId}",
    arguments = listOf(navArgument("itemId") { type = NavType.IntType })
) { /* ... */ }

Optional Query Arguments

Some values are optional, like a search filter. You add them as query parameters after a question mark in the route.

navController.navigate("search?query=kotlin")

What Is a Deep Link

A deep link is a URL that opens a specific screen directly, even from outside the app. It maps a link to a route.

Register a Deep Link

You attach a deepLink pattern to a destination. When that URL arrives, navigation jumps straight to this screen.

composable(
    "details/{itemId}",
    deepLinks = listOf(navDeepLink { uriPattern = "myapp://details/{itemId}" })
) { /* ... */ }

Deep Links Carry Arguments Too

The same placeholders work in a deep link URL. The itemId from the link lands in your back stack entry like any argument.

Platforms Wire Links Differently

Android and iOS each register your URL scheme in their own config, but both then hand the link to the shared graph. 🔗

Keep Arguments Small

Pass an id, not a whole object. Let the destination load its own data from the id, so routes stay tiny and reliable.

Quick Check

How should you typically send a complex object to the next screen?

Recap: Data and Direct Links

You sent arguments through routes, read them on the next screen, and mapped a deep link URL straight to a destination. 🎯

よくある質問

「ArgumentsとDeep Linksを渡す」レッスンは無料ですか?

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

「ArgumentsとDeep Linksを渡す」で何を学びますか?

遷移先の間でデータを安全に渡します ブラウザで直接実行するハンズオンコードでKotlin Multiplatform Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

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

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

「ArgumentsとDeep Linksを渡す」レッスンにはどのくらい時間がかかりますか?

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

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

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

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

  1. 共有画面間を移動する
  2. ArgumentsとDeep Linksを渡す
  3. 共有Images、Fonts、Strings
  4. 共有UIテキストをローカライズする
← Kotlin Multiplatform Academyに戻る