 
 extension UIViewController {
   func screenshotFromWindow(scale: CGFloat = 0.0) -> UIImage? {
-
     if let window = UIApplication.sharedApplication().windows.first as? UIWindow {
       UIGraphicsBeginImageContextWithOptions(window.frame.size, false, scale)
       window.drawViewHierarchyInRect(window.bounds, afterScreenUpdates: true)

}

extension SAHistoryNavigationViewController {

  override public func showHistory() {

    super.showHistory()

    if let image = visibleViewController.screenshotFromWindow(scale: SAHistoryNavigationViewController.kImageScale) {

      UIGraphicsEndImageContext()
      return image
    }
    return nil
  }
}
