public func viewController() -> UIViewController? { var responder = self.next; repeat { if (responder?.isKind(of: UIViewController.classForCoder()))! { return responder as? UIViewController } responder = responder?.next } while((responder) != nil) return nil; }