 import UIKit
 import Reachability
 
+@objc public protocol SHNetworkObserverDelegate : class {
+    func networkStatus( isReachable: Bool)
+}
+
 final class SHNetworkObserver: NSObject {
     
     private static let reachability = Reachability()!

            print("Notification object is not of type Reachability")
            return
        }
        SHNetworkObserver.connection = reachability.connection
        switch reachability.connection {
        case .none:
        
            print("Network Unreachable")
            let appDel = UIApplication.shared.delegate
            appDel?.window??.rootViewController?.present(SHNetworkObserver.noConnectionVC, animated: true, completion: nil)
//            AppDelegate.topViewController?.present(SHNetworkObserver.noConnectionVC, animated: true, completion: nil)
        case .cellular, .wifi:
            if AppDelegate.topViewController == SHNetworkObserver.noConnectionVC {
                AppDelegate.topViewController?.dismiss(animated: true, completion: nil)
            }
            print("Network Reachable")
       
        }
        
    }

    
    private static var connection: Reachability.Connection = .none
    
    private static weak var delegate: SHNetworkObserverDelegate?
    
    static var isNetworkAvailable : Bool {
        return connection != .none
    }
    
    class func addDelegate(delegate: SHNetworkObserverDelegate) {
        SHNetworkObserver.delegate = delegate
    }
    
    class func removeDelegate(delegate: SHNetworkObserverDelegate) {
        SHNetworkObserver.delegate  = nil
    }
    
    class func recheckConnection() {
        if SHNetworkObserver.delegate != nil {
            SHNetworkObserver.delegate?.networkStatus(isReachable: SHNetworkObserver.isNetworkAvailable)
        }
    }
    
    class func startMonitoring() {
        
