0Pricing
SwiftUI Academy · บทเรียน

ผืนผ้าใบแสดงตัวอย่างแบบสด

ใช้การแสดงตัวอย่างของ Xcode เพื่อดูการเปลี่ยนแปลงส่วนติดต่อผู้ใช้ได้ทันที

ผืนผ้าใบแสดงตัวอย่างแบบสด เป็นบทเรียน SwiftUI Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน SwiftUI Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส SwiftUI Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Meet the Canvas

Beside your code, Xcode shows a canvas that renders your view live. You see your UI without ever building and launching the full app. 👀

Show or Hide It

If the canvas is missing, open the Editor menu and turn on Canvas. It appears on the right, next to your Swift code.

The #Preview Block

A small #Preview block at the bottom of the file tells the canvas what to render. The template adds one for ContentView automatically.

#Preview {
    ContentView()
}

Live Updates

Change your code and the canvas refreshes almost instantly. This live update loop is what makes SwiftUI feel fast and playful. ⚡

Try an Edit

Edit the Text view's wording and watch the canvas change as you type. Seeing results immediately makes experimenting safe and fun.

Text("Hello, SwiftUI!")

Resume the Preview

Sometimes the canvas pauses and shows a Resume button. Click it to restart the preview after a change it could not apply live.

Interactive Mode

The play-style live mode lets you tap and scroll right in the canvas. You can test buttons and gestures without a simulator.

Preview Devices

You can point a preview at a specific device, like an iPhone SE. This helps you check how your layout looks on smaller screens.

Multiple Previews

Add more than one #Preview block to compare states side by side, such as light mode next to dark mode at the same time.

Previews Are Not Shipped

Preview code is for development only. It never ships to users, so feel free to fill previews with fake sample data.

Faster Than Building

The canvas is far quicker than a full build. Use it as your main loop while designing, and reach for the simulator only for deeper testing.

Quick Check

Which block in your file tells the canvas what to render?

Recap

The canvas renders your view live via a #Preview block, updating as you type. It is your fastest way to design and iterate. 🎨

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

บทเรียน “ผืนผ้าใบแสดงตัวอย่างแบบสด” ฟรีหรือไม่

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

คุณจะเรียนรู้อะไรในบทเรียน “ผืนผ้าใบแสดงตัวอย่างแบบสด”

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

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

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

บทเรียน “ผืนผ้าใบแสดงตัวอย่างแบบสด” ใช้เวลานานแค่ไหน

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

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

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

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

  1. การติดตั้ง Xcode และสร้างโครงการ
  2. ส่วนประกอบของไฟล์แอป SwiftUI
  3. ผืนผ้าใบแสดงตัวอย่างแบบสด
  4. การเรียกใช้บนตัวจำลองและอุปกรณ์
← กลับไปที่ SwiftUI Academy