Это работает для меня на детской площадке:
import UIKit
import PlaygroundSupport
let seg = UISegmentedControl(items: ["foo", "bar"])
seg.setTitleTextAttributes([.foregroundColor: UIColor.red], for: .normal)
seg.setTitleTextAttributes([.foregroundColor: UIColor.blue], for: .selected)
seg.selectedSegmentIndex = 0
PlaygroundPage.current.liveView = seg