This repository demonstrate triggering a UIAppearance
refresh without having to remove views from the hierarchy and re-add them. This fixes several problems with presented view controllers.
Read the full blog post: https://datwelk.substack.com/p/realtime-uiappearance-refresh
Use Swift Package Manager.
Call appearance selectors as follows:
@import RDRAppearance;
[[UIButton rdr_appearance] setBackgroundColor:...];
[[UIButton rdr_appearanceWhenContainedInInstancesOfClasses:@[[UIViewController class]]] setBackgroundColor...];
Trigger a refresh:
@import RDRAppearance;
[UIView rdr_refreshAppearance];
Call appearance selectors as follows:
import RDRAppearance
UIButton.rdr_appearance().backgroundColor = ...
UIButton.rdr_appearance(whenContainedInInstancesOf: [UIViewController.self]).backgroundColor = ...
Trigger a refresh:
import RDRAppearance
UIView.rdr_refreshAppearance()