import SwiftUI struct SortCaseRowView: View { @Binding var selectedType: SortCriteria let type: SortCriteria var body: some View { Button(action: { selectedType = type}) { HStack { Text(type.text) .foregroundColor(.primary) Spacer() if selectedType == type { Image(systemSymbol: .checkmark) } } .padding(.horizontal) .padding(.vertical, 8) .background(Color(UIColor.systemGroupedBackground)) .cornerRadius(8) } } } struct SortCaseRowView_Previews: PreviewProvider { static var previews: some View { SortCaseRowView(selectedType: .constant(.id), type: .id) .previewLayout(.fixed(width: 375, height: 50)) } }