Itens de aba e distintivos
Adicione ícones, títulos e distintivos de notificação.
Itens de aba e distintivos é uma aula grátis de SwiftUI Academy no CoddyKit. Esta é a aula 2 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.
Polishing Each Tab
Now you will make each tab clearer with the right icon, a short title, and a notification badge when needed. 🎨
Icons with SF Symbols
Pass an SF Symbol name to Label so each tab gets a crisp, scalable icon that matches the system style.
Label("Profile", systemImage: "person.crop.circle")Keep Titles Short
Tab titles sit in a tight space, so keep them to one clear word like Home, Search, or Profile.
Selected vs Unselected
iOS automatically highlights the active tab. Many symbols even swap to a filled variant when selected, with no code from you.
Choosing Good Symbols
Pick symbols whose meaning is obvious. A house for home and a gear for settings need no explanation.
What a Badge Shows
A badge is the small red bubble on a tab that signals unread items, like new messages waiting for you. 🔴
Adding a Number Badge
The badge modifier puts a count on a tab. Pass a number and the bubble appears automatically.
InboxScreen()
.tabItem { Label("Inbox", systemImage: "tray") }
.badge(3)Text Badges
You can also pass a string to badge, useful for short markers like "New" instead of a count.
.badge("New")Hiding a Badge
Set the badge to zero or an empty value and SwiftUI hides the bubble, so it appears only when it matters.
.badge(unreadCount)Driving Badges from State
Bind the badge to a state value so the count updates live as new items arrive or get read.
Badges Demand Attention
Use badges sparingly. A bubble pulls the eye, so reserve it for things the user truly needs to notice. 👀
Quick Check
Let us check how to show an unread count on a tab.
Recap: Tab Items & Badges
Clear icons and short titles make tabs scannable, and the badge modifier surfaces counts or markers right when users need them. 🎉
Perguntas Frequentes
A aula “Itens de aba e distintivos” é grátis?
Sim — o texto completo de “Itens de aba e distintivos” é 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 “Itens de aba e distintivos”?
Adicione ícones, títulos e distintivos de notificação. 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 2 de 4.
Quanto tempo leva a aula “Itens de aba e distintivos”?
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
- Criando uma barra de abas
- Itens de aba e distintivos
- Vinculação da aba selecionada
- Combinando abas com pilhas