Swift how to set default text color for UISegmentedControl?
Swift 5+ code to update text color for your UISegmentedControl
(sc
in this example)
// selected option color
sc.setTitleTextAttributes([.foregroundColor: UIColor.green], for: .selected)
// color of other options
sc.setTitleTextAttributes([.foregroundColor: UIColor.white], for: .normal)
UISegmentedControl.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.redColor()], forState: .Selected)