0Pricing
SwiftUI Academy · درس

الأقسام وأنماط القوائم

اجمع الصفوف في أقسام واختر نمطاً للقائمة

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

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

Grouping with Sections

A long list reads better when split into chunks. Section groups related rows under a shared heading. 🗂️

List {
    Section("Fruits") {
        Text("Apple")
    }
}

Headers and Footers

A Section can show a header above its rows and a footer below, great for titles and helper text.

Section {
    Text("Wi-Fi")
} header: {
    Text("Network")
} footer: {
    Text("Tap to connect")
}

Multiple Sections

Stack several Section blocks in one List to organize a busy screen into clear, labeled groups that are easy to scan.

List {
    Section("On") { Text("Item A") }
    Section("Off") { Text("Item B") }
}

Sections With ForEach

Combine Section with ForEach to build grouped, data-driven lists, like contacts sorted by letter.

Section("A") {
    ForEach(aNames, id: \.self) { Text($0) }
}

Meet List Styles

The listStyle modifier changes a list's whole look, from grouped cards to plain edge-to-edge rows.

List { Text("Row") }
    .listStyle(.insetGrouped)

The Inset Grouped Look

insetGrouped is the default rounded-card style you see in Settings, with spacing around each section.

.listStyle(.insetGrouped)

The Plain Style

The plain style removes the card insets for full-width, edge-to-edge rows, ideal for feeds and chat-like screens.

.listStyle(.plain)

The Grouped Style

The grouped style gives boxed sections without the rounded inset corners, a classic full-width table look.

.listStyle(.grouped)

Styling Section Headers

You can restyle a header with modifiers, changing its font, color, or case to match your design.

header: {
    Text("Network").font(.headline)
}

Collapsible Sections

A header can act as a control too, letting you build expandable sections that show or hide their rows.

Pick the Right Style

Choose a style that fits the screen: insetGrouped for settings, plain for content feeds. The data stays the same. ✨

Quick Check

Match each concept to its job.

Recap

You learned Section and listStyle: group rows into labeled chunks and switch looks like insetGrouped or plain. 🎉

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

هل درس «الأقسام وأنماط القوائم» مجاني؟

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

ماذا ستتعلم في «الأقسام وأنماط القوائم»؟

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

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

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

كم من الوقت يستغرق درس «الأقسام وأنماط القوائم»؟

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

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

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

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

  1. إنشاء قائمة ثابتة
  2. التكرار باستخدام ForEach
  3. Identifiable والمعرّفات المستقرة
  4. الأقسام وأنماط القوائم
← العودة إلى SwiftUI Academy