0

When recently updating to the latest xcode, all my UISwitch changed to use the default color.

Basically it means that this doesn't seem to work anymore:

UISwitch.appearance().onTintColor = Color.red

I can't find a reference to any change and I'm not sure how to get it to work again. Any advice would be appreciated!

marcgg
  • 65,020
  • 52
  • 178
  • 231
  • Does this helps you: https://stackoverflow.com/questions/56479674/set-toggle-color-in-swiftui – Kishan Bhatiya Oct 02 '20 at 09:43
  • @KishanBhatiya Not really, it's even mentioned in the comments that the answer is now invalid since iOS14: https://stackoverflow.com/questions/56479674/set-toggle-color-in-swiftui#comment111813416_57562246 – marcgg Oct 02 '20 at 09:57
  • 1
    This might help you: https://stackoverflow.com/a/57931945/8697793 – pawello2222 Oct 02 '20 at 10:21
  • Thanks! It does work, but this is only for iOS 14 and means it'll break on iOS 13. Isn't there something that would work on both? – marcgg Oct 02 '20 at 14:35
  • You can use `if #available(iOS 14.0, *)` – pawello2222 Oct 02 '20 at 16:21

0 Answers0