Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.1 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.1 KB

RDRAppearance

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

clip

Install

Use Swift Package Manager.

How to use

Objective-C

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];

Swift

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()