title: Question about how to run code the same on all screens in an app in Swift
body: <p>I have written code to check the status of a network connection. I used the <strong>Reachability</strong> library.</p>
  
  <pre><code>let reachability = Reachability()!
  
  reachability.whenReachable = { reachability in
              if reachability.connection == .wifi {
                  print("Reachable via WiFi")
                  CustomActivityIndicator.shared.hide(uiView: self.view)
              } else {
                  print("Reachable via Cellular")
                  CustomActivityIndicator.shared.hide(uiView: self.view)
              }
          }
  
          reachability.whenUnreachable = { _ in
              print("Not reachable")
  
              CustomActivityIndicator.shared.show(uiView: self.view, labelText: "Not reachable", backgroundColor: self.color, textColor: .white, animated: false, duration: 0)
          }
  
          do {
              try reachability.startNotifier()
          } catch {
              print("Unable to start notifier")
          }
  </code></pre>
  
  <p>I also wrote code that notifies the user via the <code>CustomActivityIndicator</code> when the network is disconnected and hides the <code>CustomActivityIndicator</code> when reconnected.</p>
  
  <p>Where should I put the code so that it works on all screens of the app?</p>