Skip to content

Instantly share code, notes, and snippets.

@vivalalova
Created January 21, 2017 18:58
Show Gist options
  • Select an option

  • Save vivalalova/9a3664dd7f2637fc7e67550ac6d8dd32 to your computer and use it in GitHub Desktop.

Select an option

Save vivalalova/9a3664dd7f2637fc7e67550ac6d8dd32 to your computer and use it in GitHub Desktop.
view manager
struct ViewManager {
static let rootViewController = UIApplication.sharedApplication().keyWindow?.rootViewController
static let statusBarHeight = UIApplication.sharedApplication().statusBarFrame.size.height
static var currentWindow: UIWindow? {
if let window = UIApplication.sharedApplication().keyWindow {
return window
} else {
return UIApplication.sharedApplication().windows[0] as? UIWindow
}
}
static func navigationBarHeight(callFrom: UIViewController) - > CGFloat {
return callFrom.navigationController?.navigationBar.frame.size.height ?? 44
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment