ScrollView الأفقي والرأسي
مرّر محتوى عشوائيًا في أي اتجاه
ScrollView الأفقي والرأسي درس مجاني في SwiftUI Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في SwiftUI Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة SwiftUI Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Beyond One Screen
Sometimes your content is taller than the screen. A ScrollView lets users glide past the edges to see it all. 📜
ScrollView {
Text("Lots of content here")
}Vertical by Default
A plain ScrollView scrolls up and down. Wrap a tall VStack inside and everything becomes swipeable.
ScrollView {
VStack {
Text("Top")
Text("Bottom")
}
}Going Horizontal
Pass .horizontal as the axis and your content scrolls left and right instead, great for image carousels.
ScrollView(.horizontal) {
HStack {
Text("One")
Text("Two")
}
}Pick Your Axis
The first argument is the axis: use .vertical, .horizontal, or even both for free, two-way scrolling.
ScrollView([.horizontal, .vertical]) {
BigContent()
}Hiding the Indicator
Set showsIndicators to false to hide the little scroll bar for a cleaner, more designed look.
ScrollView(.horizontal, showsIndicators: false) {
HStack { /* cards */ }
}Content Sizes Itself
A ScrollView only scrolls when its content is bigger than the visible area. Short content just sits still.
Pair with a Stack
Always put a VStack or HStack inside, since a ScrollView holds one child and the stack lines the rest up.
ScrollView {
VStack(spacing: 16) {
Card()
Card()
}
}Free-form vs List
Reach for a ScrollView when you want full layout freedom; a List adds rows and separators for you.
Add Some Padding
Give inner content padding so it does not hug the screen edges as users scroll past it.
ScrollView {
VStack { /* content */ }
.padding()
}Carousels Made Easy
A horizontal ScrollView of cards is the classic recipe for a swipeable carousel of photos or products.
ScrollView(.horizontal) {
HStack {
ForEach(items) { Card($0) }
}
}Smooth and Native
Scrolling feels buttery because ScrollView uses the same engine as the rest of iOS. It just works. ✨
Quick Check
Think about which direction you want to move.
Recap
You learned that a ScrollView reveals overflowing content, scrolls vertically by default, and goes horizontal with an axis. 🎉
الأسئلة الشائعة
هل درس «ScrollView الأفقي والرأسي» مجاني؟
نعم — نص درس «ScrollView الأفقي والرأسي» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة SwiftUI Academy، انتقل إلى CoddyKit PRO. تتضمن دورة SwiftUI Academy 4 دروس في المجموع.
ماذا ستتعلم في «ScrollView الأفقي والرأسي»؟
مرّر محتوى عشوائيًا في أي اتجاه تتمرن على SwiftUI Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ SwiftUI Academy؟
لا تُشترط خبرة سابقة. SwiftUI Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «ScrollView الأفقي والرأسي»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس SwiftUI Academy هذا؟
نعم. كل درس في SwiftUI Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- ScrollView الأفقي والرأسي
- LazyVStack وLazyHStack
- شبكات متكيفة باستخدام LazyVGrid
- ScrollView Reader والمراسي