EnterpriseDS Documentation

Structure DSUIRadio

@available(iOS 13.0, tvOS 13.0, *)
public struct DSUIRadio<T: DSUISelectionGroupItem>: View, DSSelectionControlDetails  

An Enterprise-styled push button element in the style of a radio button for use in SwiftUI views.

item is a DSUISelectionGroupItem initializer parameter groupName is a string initializer parameter selectedItem is a binding optional of DSUISelectionGroupItem initializer parameter

When enabled/disabled, the background color changes. In some situations, you may want this color to propagate to the superview automatically. To allow that, use the binding sharedBackgroundColor optional initializer parameter to extract the color and used it in a parent view.

Initialize and set properties as needed individually or in a ForEach

DSUIRadio(item: step1Config.radioDrinks[index], groupName: "Group Name",
    selectedItem: $step1Config.selectedDrink, sharedBackgroundColor: $checkboxBackgroundColor)

ForEach(step1Config.radioDrinks.indices) { index in
    DSUIRadio(item: step1Config.radioDrinks[index], groupName: favoriteDrinkGroup, selectedItem: $step1Config.selectedDrink)
        .disabled(index == 3)
        .frame(minWidth: .zero, maxWidth: .infinity)
DSUIRadio DSUIRadio DSSelectionControlDetails DSSelectionControlDetails DSUIRadio->DSSelectionControlDetails View View DSUIRadio->View

Conforms To




public init(item:  T, groupName: String = "", selectedItem: Binding<T?>? = nil, sharedBackgroundColor: Binding<Color?>? = nil)  

Initializes and creates a radio button .


item T

The DSUISelectionGroupItem holding the title of radio button.

group​Name String

The groupName of radio button.

selected​Item Binding<T?>?

The is binding optional of DSUISelectionGroupItem to keep track of selction state.

shared​Background​Color Binding<Color?>?

The binding optional of Color to extract the background color of the radio button.



public var body: some View