Tab-Elemente und Badges
Fügen Sie Symbole, Titel und Benachrichtigungs-Badges hinzu.
Tab-Elemente und Badges ist eine kostenlose SwiftUI Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des SwiftUI Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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. 🎉
Häufig gestellte Fragen
Ist die Lektion „Tab-Elemente und Badges“ kostenlos?
Ja — der vollständige Text von „Tab-Elemente und Badges“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des SwiftUI Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Tab-Elemente und Badges“?
Fügen Sie Symbole, Titel und Benachrichtigungs-Badges hinzu. Du übst SwiftUI Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um SwiftUI Academy zu starten?
Keine Vorkenntnisse erforderlich. SwiftUI Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Tab-Elemente und Badges“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser SwiftUI Academy-Lektion Code schreiben und ausführen?
Ja. Jede SwiftUI Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Eine Tab-Leiste erstellen
- Tab-Elemente und Badges
- Bindung des ausgewählten Tabs
- Tabs mit Stacks kombinieren