override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
print("changed")
}
}
The iOS 13 application just goes to background without changing the mode (light/dark) but the "print" function is called. Is it possible to determine the moment when the mode really changed?
Thank You.
UIApplication.shared.applicationState == .active
to avoid the problem. Though note then you need to make sure you update your interface properly when the app resumes active if the interface style changes while it's not active. – Fluorosis