0Pricing
SwiftUI Academy · Aula

Seções e estilos de lista

Agrupe linhas com seções e escolha um estilo de lista.

Seções e estilos de lista é uma aula grátis de SwiftUI Academy no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de SwiftUI Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de SwiftUI Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

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. 🎉

Perguntas Frequentes

A aula “Seções e estilos de lista” é grátis?

Sim — o texto completo de “Seções e estilos de lista” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de SwiftUI Academy, atualize para CoddyKit PRO. O curso de SwiftUI Academy inclui 4 aulas no total.

O que vou aprender em “Seções e estilos de lista”?

Agrupe linhas com seções e escolha um estilo de lista. Você pratica SwiftUI Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar SwiftUI Academy?

Nenhuma experiência prévia é necessária. SwiftUI Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Seções e estilos de lista”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de SwiftUI Academy?

Sim. Cada aula de SwiftUI Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Criando uma lista estática
  2. Repetindo com ForEach
  3. Identifiable e IDs estáveis
  4. Seções e estilos de lista
← Voltar para SwiftUI Academy