import SwiftUI struct FilterChip: Identifiable, Equatable { let id = UUID() let label: String var isSelected: Bool = false } struct FilterChipsView: View { @Binding var chips: [FilterChip] var body: some View { ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 8) { ForEach($chips) { $chip in Button { withAnimation(.spring(response: 0.24, dampingFraction: 0.9)) { chip.isSelected.toggle() } } label: { HStack(spacing: 6) { if chip.isSelected { Image(systemName: "checkmark") .font(.caption2.weight(.bold)) } Text(chip.label) .font(.caption.weight(.semibold)) } .padding(.horizontal, 14) .padding(.vertical, 9) .background( chip.isSelected ? Color.accentColor.opacity(0.16) : Color(.systemBackground), in: Capsule() ) .overlay( Capsule() .stroke( chip.isSelected ? Color.accentColor.opacity(0.35) : Color.primary.opacity(0.06), lineWidth: 1 ) ) .foregroundStyle(chip.isSelected ? Color.accentColor : .primary) } .buttonStyle(.plain) } } .padding(.vertical, 2) } } }