How to use this library for gradient colors as they haven't mentioned the usage of gradient with ThemeAnyPicker in their documentation.
I am using plist method which is much easier way than the other one. (This library can be used in 2 ways : Index method and Plist method)
Theme library link : https://github.com/wxxsw/SwiftTheme
I have given the code below.
@IBDesignable class GradientView: UIView {
override class var layerClass: AnyClass {
return CAGradientLayer.self
}
override func layoutSubviews() {
// MARK: - Default gradient (Without applying Swift theme library)
(layer as! CAGradientLayer).colors = [topColor.cgColor, bottomColor.cgColor]
// MARK: - With Swift Theme library applied
(layer as! CAGradientLayer).theme_colors = // What should be the code here?
}
}
Listen for color changes and reset the color of the drawing in the callback