draveness / NightNight

Elegant way to integrate night mode to swift projects
MIT License
774 stars 56 forks source link

night and normal background color not working. #16

Closed commando24 closed 7 years ago

commando24 commented 7 years ago

I am setting night background and normal background color in storyboard but its not working. I tried to print property mixedBackgroundColor of view but it shows nil.

commando24 commented 7 years ago

I found a solution for this situation.

extension UIView {

  open override func awakeFromNib() {
    super.awakeFromNib()

    if let normalBackgroundColor = self.normalBackgroundColor, let nightBackgroundColor = self.nightBackgroundColor {
        self.mixedBackgroundColor = MixedColor(normal: normalBackgroundColor, night: nightBackgroundColor)
    }
  }
}

anyone have other solution ?

draveness commented 7 years ago

not supported storyboard yet and probably not support neither in the future