I am using the Picker in SwiftUI with the style of SegmentedPicker.
I am trying to change the colors of the picker and found this code in stackoverflow. How to change selected segment color in SwiftUI Segmented Picker
init() {
UISegmentedControl.appearance().selectedSegmentTintColor? = .blue
UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.white], for: .selected)
UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.blue], for: .normal)
}
But an error pops up saying "Return from initializer without initializing all stored properties"
What can I do to make the error diappear :(