RootWindowDesignable.swift 687 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // Created by Jake Lin on 12/25/15.
  3. // Copyright © 2015 IBAnimatable. All rights reserved.
  4. //
  5. import UIKit
  6. public protocol RootWindowDesignable: class {
  7. /**
  8. Root window background color
  9. */
  10. var rootWindowBackgroundColor: UIColor? { get set }
  11. }
  12. public extension RootWindowDesignable where Self: UIViewController {
  13. func configureRootWindowBackgroundColor() {
  14. #if NS_EXTENSION_UNAVAILABLE_IOS
  15. if let rootWindowBackgroundColor = rootWindowBackgroundColor,
  16. let delegate = UIApplication.sharedApplication().delegate,
  17. let rootWindow = delegate.window {
  18. rootWindow?.backgroundColor = rootWindowBackgroundColor
  19. }
  20. #endif
  21. }
  22. }