I have a picker in segmented style on two views in a custom tab bar and need control over all aspects of color. i have overridden appearance() on each view and i have it looking how it want at first glance, but when i switch tabs back the colors get screwed up. I assume its because im overriding the global property so a change to one is a change to all. I cannot get these colors to keep the desired color when switching tabs back and forth. Ive tried overriding appearance in the onChange and onAppear of the tab bar changes, but still end up with screwed up results. Any suggestions on how i could overcome this? in uikit, its fairly trivial but im running into a wall here.
I realize i can make my own, custom segmented control, but is it really required to go to that extreme to get color control?
im setting the colors in each view using something like this (or the same with different colors). Ive tried the same code within onChange when the tab bar selection is changed and onAppear when the tab bar (which is what creates the two problem views) is first created with lackluster results
init() {
UISegmentedControl.appearance()
.backgroundColor = UIColor.white.withAlphaComponent(0.18)
UISegmentedControl.appearance()
.selectedSegmentTintColor = UIColor.white
UISegmentedControl.appearance()
.setTitleTextAttributes([.foregroundColor: UIColor.white], for: .normal)
UISegmentedControl.appearance()
.setTitleTextAttributes([.foregroundColor: UIColor.black], for: .selected)
}