Skip to content
Swift95

Radio​Button95

A mutually exclusive value selector with native button behavior.

Radio buttons form a group by sharing the same selection binding.

Three RadioButton95 options with Automatic selected
A complete mutually exclusive group rendered by the snippet below.
import Swift95
import SwiftUI
struct RadioButton95Example: View {
private enum Mode: Hashable {
case automatic
case manual
case ask
}
@State private var selection = Mode.automatic
var body: some View {
VStack(alignment: .leading, spacing: 6) {
RadioButton95("Automatic", value: .automatic, selection: $selection)
RadioButton95("Manual", value: .manual, selection: $selection)
RadioButton95("Ask every time", value: .ask, selection: $selection)
}
}
}
Concern Behavior
Selection Every option needs a hashable value and a shared Binding<Value>.
Grouping Siblings form a group by sharing one selection binding; no extra container is required.
Accessibility The active option exposes the selected trait.
Native APIs Use swiftUI(_:) to modify the embedded Button.

Open the complete RadioButton95 API reference →