microsoft/FluentDarkModeKit

`dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?)` not called

lifution opened this issue · 2 comments

iOS 13 and newer, method dmTraitCollectionDidChange(_ previousTraitCollection: DMTraitCollection?) not called after overrideTraitCollection updated.
This problem appeared in UIImageView and UILabel.
FluentDarkModeKit version: 1.0.3

This is expected. The following classes are known to not call UIView's traitCollectionDidChange thus dmTraitCollectionDidChange cannot be bridged.

UIView subclasses: UIImageView, UILabel, UIDatePicker, UIPickerView
UIViewController subclass: UISplitViewController

My suggestion to fix it would be either:

  1. Avoid subclassing these classes, but create a container view for the classes to handle dmTraitCollectionDidChange
  2. Override traitCollectionDidChange and apply the same logic on iOS 13

@levinli303 Get it, thanks.