I have an input form with multiple TextFields to which I want add a Picker to select an enum value describing the type of organisation. The nearest I can get to what I want is the default style which produces the result shown here:
The UI code for the picker is as follows:
LabeledContent("Organisation type") {
Picker("", selection: $tradingEntity.tradingEntityType) {
ForEach(OrganisationType.allCases, id: \.self) { value in
Text(value.friendlyString)
.tag(value)
}
}
.frame(maxWidth: .infinity)
.background()
}
I cannot find any way to style the selected value, I really want to match the style of the TextFields by left justifying the selected value text with foreground colour of .primary. The list value styling is OK but I would prefer the list frame to be left justified.
The PickerStyle protocol has the following implementation methods but there is no supporting documentation help on how to implement them.
static func _makeView<SelectionValue>(value: _GraphValue<_PickerValue<ModifiedPickerStyle, SelectionValue>>, inputs: _ViewInputs) -> _ViewOutputs where SelectionValue : Hashable {
// code
}
static func _makeViewList<SelectionValue>(value: _GraphValue<_PickerValue<ModifiedPickerStyle, SelectionValue>>, inputs: _ViewListInputs) -> _ViewListOutputs where SelectionValue : Hashable {
// code
}
How can I implement theses methods to create the desired style or is there a simpler way to achieve the result I'm after?



VStackorListand style it any way you want.