I am following this tutorial. In its AppDelegate it has a customizeAppearance() where UISearchBar & UINavigationBar are type/class properties. Shouldn't they be a property of something like the window or the current viewController we are in?! How can we just message a class and then have it change our UI?
FWIW when I cmmd click...obviously it just takes it to the class definition.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  var backgroundSessionCompletionHandler: (() -> Void)?
  var window: UIWindow?
  let tintColor =  UIColor(red: 242/255, green: 71/255, blue: 63/255, alpha: 1)
  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    customizeAppearance()
    return true
  }
  func application(application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: () -> Void) {
    backgroundSessionCompletionHandler = completionHandler
  }
  // MARK - App Theme Customization
  private func customizeAppearance() {
    window?.tintColor = tintColor
    UISearchBar.appearance().barTintColor = tintColor // shouldn't UISearchBar be a property of some other object?
    UINavigationBar.appearance().barTintColor = tintColor // shouldn't UINavigationBar be a property of some other object?
    UINavigationBar.appearance().tintColor = UIColor.whiteColor()
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]
  }
}
 
    