iOS 13 introduced some changes to the UISegmentedControl including a really nice animation when switching the selected segment. However I\'m noticing that it\'s not displaying t
Works for me (Swift 5).
let background = myColors.background
let selectedColor = myColors.foreground
if #available(iOS 13.0, *)
{
segmentedControl.tintColor = background
segmentedControl.backgroundColor = background
segmentedControl.selectedSegmentTintColor = selectedColor
segmentedControl.setTitleTextAttributes([.foregroundColor: selectedColor as Any], for: .normal)
segmentedControl.setTitleTextAttributes([.foregroundColor: background as Any], for: .selected)
}
else
{
segmentedControl.tintColor = background
segmentedControl.backgroundColor = selectedColor
segmentedControl.layer.cornerRadius = 4
}