My problem was also described here UIColor return wrong values for dark mode colors by Lee Andrew
Basically border color for buttons is not being picked properly. In my case scenario is:
Button's border there was not updated properly. It was using color for white mode, text however changed color properly.
Solution for layer.background proposed in question listed above doesn't help... using not beta xcode Version 11.0 (11A420a) if that helps. Can really use help here... I'm out of options. Calling setNeedsDisplay for button doesn't help either.
Update. Got the thing sorted out. Direct call of the button didn't work. However after I've overrided traitCollectionDidChange method on everything with button with border color (cells, footer, header, etc) - thing begin to work properly.
To solve your problem:
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
// Your custom borderColor
layer.borderColor = .white
}
Note: If you're using tableview/collectionview you have to set the color in the object and in the border "init" else only the visible cells will update the border color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With