Umschalter mit erweiterter Beschriftung und Symbol
Kombiniert Text und Symbol in einer benutzerdefinierten Umschaltbeschriftung für mehr Übersichtlichkeit.
import SwiftUI
struct ContentView: View {
@State private var notificationsEnabled = true
var body: some View {
Toggle(isOn: $notificationsEnabled) {
HStack {
Image(systemName: notificationsEnabled ? "bell.fill" : "bell.slash")
Text("Notifications")
}
}
.toggleStyle(.switch)
.padding()
}
}