0Pricing
Kotlin Multiplatform Academy · บทเรียน

ส่งอาร์กิวเมนต์และลิงก์เชิงลึก

ย้ายข้อมูลระหว่างปลายทางอย่างปลอดภัย

ส่งอาร์กิวเมนต์และลิงก์เชิงลึก เป็นบทเรียน Kotlin Multiplatform Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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. 🎯

คำถามที่พบบ่อย

บทเรียน “ส่งอาร์กิวเมนต์และลิงก์เชิงลึก” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ส่งอาร์กิวเมนต์และลิงก์เชิงลึก” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Kotlin Multiplatform Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Kotlin Multiplatform Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ส่งอาร์กิวเมนต์และลิงก์เชิงลึก”

ย้ายข้อมูลระหว่างปลายทางอย่างปลอดภัย คุณปฏิบัติ Kotlin Multiplatform Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Kotlin Multiplatform Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Kotlin Multiplatform Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน

บทเรียน “ส่งอาร์กิวเมนต์และลิงก์เชิงลึก” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Kotlin Multiplatform Academy นี้ได้ไหม

ได้ บทเรียน Kotlin Multiplatform Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. นำทางระหว่างหน้าจอ shared
  2. ส่งอาร์กิวเมนต์และลิงก์เชิงลึก
  3. รูปภาพ ฟอนต์ และสตริงแบบ shared
  4. แปลข้อความ UI แบบ shared
← กลับไปที่ Kotlin Multiplatform Academy