//
//  RadioButton.swift
//  demo
//
//  Created by Jason on 2024/1/26.
//

import SwiftUI

struct RadioButton: View {
    @Binding public var checked: Bool
    var label: String = ""
    var labelSize: Double = 14
    var radioSize: Double = 18

    var body: some View {
        HStack(spacing: 4, content: {
            Image(systemName: checked ? "checkmark.circle.fill" : "circle")
                .resizable()
                .frame(width: radioSize, height: radioSize)
                .foregroundColor(checked ? Color.orange : Color.gray)
            Text(label)
                .font(.system(size: labelSize))
        })
        .onTapGesture {
            checked.toggle()
        }
    }
}
