Search code examples
swiftxcodeswift3swiftuiuipickerview

Change the color of a focused element (Picker) SwiftUI - WatchOS


How can I change the focus color of a selected element in WatchOS7 with swiftUI. Here's my example below with a Picker whose focus color is green (the default one) but I want to change it to blue to be consistant with my app layout.

enter image description here

I search over the internet and stackoverflow but did not find andy solution to this. Is it possible to do it in SwiftUI.


Solution

  • That's the focus color and you cannot change it. At least no with standard view modifiers like .accentColor, .tint, etc.

    You can try to hide it by overlying another view (like in this response), for example, or try to reach to UIKit using instrospection.

    Probably it's best to be at peace with the fact that it's system behavior.