     public typealias OAuthViewController = NSViewController
 #endif
 
+// Delegate for OAuthWebViewController
+public protocol OAuthWebViewControllerDelegate {
+    // Did web view presented (work only without navigation controller)
+    func didPresent()
+    // Did web view dismiss (work only without navigation controller)
+    func didDismiss()
+}
+
+// A web view controller, which handler OAuthSwift authentification.
 public class OAuthWebViewController: OAuthViewController, OAuthSwiftURLHandlerType {
-
+    
+    #if os(iOS) || os(tvOS)
+    public var delegate: OAuthWebViewControllerDelegate?
+    #endif
+    
     public func handle(url: NSURL) {
         // do UI in main thread
         if NSThread.isMainThread() {

    }

    public func dismissWebViewController() {
        #if os(iOS) || os(tvOS)
            self.dismissViewControllerAnimated(true, completion: nil)
        #elseif os(watchOS)
            self.dismissController()
        #elseif os(OSX)

    public static var userActivityType: String = "org.github.dongri.oauthswift.connect"
    #endif

    public func doHandle(url: NSURL) {
        let completion: () -> Void = { [unowned self] in
            self.delegate?.didPresent()
        }
        #if os(iOS) || os(tvOS)
            let animated = true
            if let navigationController = self.navigationController {
                navigationController.pushViewController(self, animated: animated)
            }
            else if let p = self.parentViewController {
                p.presentViewController(self, animated: animated, completion: completion)
            }
            else {
                #if !OAUTH_APP_EXTENSIONS
                    UIApplication.topViewController?.presentViewController(self, animated: animated, completion: completion)
                #endif
            }
        #elseif os(watchOS)
