セクションと List のスタイル
セクションで行をまとめ、List のスタイルを選択します。
「セクションと List のスタイル」はCoddyKit上の無料SwiftUI Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これは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. 🎉
よくある質問
「セクションと List のスタイル」レッスンは無料ですか?
はい。「セクションと List のスタイル」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、SwiftUI Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 SwiftUI Academyコースには全4レッスンが含まれています。
「セクションと List のスタイル」で何を学びますか?
セクションで行をまとめ、List のスタイルを選択します。 ブラウザで直接実行するハンズオンコードでSwiftUI Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
SwiftUI Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのSwiftUI Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「セクションと List のスタイル」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このSwiftUI Academyレッスンでコードを書いて実行できますか?
はい。すべてのSwiftUI Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 静的な List の作成
- ForEach によるループ
- Identifiable と安定した ID
- セクションと List のスタイル