Appearance proxies / UI_APPEARANCE_SELECTOR in Swift?

Mark your custom view property as dynamic.

For example:

class YourCustomView: UIView {
    @objc dynamic var subviewColor: UIColor? {
        get { return self.yourSubview.backgroundColor }
        set { self.yourSubview.backgroundColor = newValue }
    }
    ...
}

Then:

YourCustomView.appearance().subviewColor = UIColor.greenColor()

Leave a Comment