RadioButton.swift 461 B

1234567891011121314151617181920
  1. import SwiftUI
  2. struct RadioButton: View {
  3. var isSelected: Bool
  4. var label: String
  5. var action: () -> Void
  6. var body: some View {
  7. Button(action: {
  8. action()
  9. }) {
  10. HStack {
  11. Image(systemName: isSelected ? "largecircle.fill.circle" : "circle")
  12. Text(label) // Add label inside the button to make it tappable
  13. }
  14. }
  15. .buttonStyle(PlainButtonStyle())
  16. }
  17. }