I want to set the selected segment color in a SwiftUI segmented picker and change the text color to white.
I have tried both using the modifiers for the picker view and modifying the tint color from the appearance proxy. None of them seem to work, unfortunately.
import SwiftUI
struct PickerView: View {
@State var pickerSelection = 0
init() {
UISegmentedControl.appearance().tintColor = UIColor.blue
}
var body: some View {
Picker(selection: $pickerSelection, label: Text("")) {
Text("Active").tag(0).foregroundColor(Color.white)
Text("Completed").tag(1)
}.pickerStyle(SegmentedPickerStyle()).foregroundColor(Color.orange)
}
}
Is there any way to do this in SwiftUI, or should I just use the UISegmentedControl by using UIViewControllerRepresentable?