I use traitCollectionDidChange in my swift classes to successfully trigger dark mode changes. Like this:
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
toggleDarkMode()
}
Works great. It triggers every time I switch between modes. But for my objective-c classes the delegate don't trigger when switching between dark and light mode. Code looks similar:
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[self toggleDarkMode];
}
I can only get it to trigger by going out of the view, then back in again. Is there something I have missed in the objective-c code?
I get it working calling super: