title: How do I use this code in a singleton in swift?
body: <p>I have this code that I found here. Now I would like to know how to use it in a singleton. My understanding is if I use this code in a singleton I will be noticed if there is a change in the network status.</p>
  
  <pre><code> func startNetworkReachabilityObserver() {
      let reachabilityManager = Alamofire.NetworkReachabilityManager(host: "www.google.com")
      reachabilityManager?.listener = { status in
  
          switch status {
  
          case .NotReachable:
              print("The network is not reachable")
  
          case .Unknown :
              print("It is unknown whether the network is reachable")
  
          case .Reachable(.EthernetOrWiFi):
              print("The network is reachable over the WiFi connection")
  
          case .Reachable(.WWAN):
              print("The network is reachable over the WWAN connection")
  
          }
      }
  
      // start listening
      reachabilityManager?.startListening()
  }
  </code></pre>