SHARE
TWEET

Untitled

a guest Jun 24th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let monitor = NWPathMonitor()
  2.     let queue = DispatchQueue.global(qos: .background)
  3.  
  4. override func viewDidLoad() {
  5.         super.viewDidLoad()
  6.    monitor.pathUpdateHandler = { path in
  7.             if path.status == .satisfied {
  8.                 print("Connected")
  9.             }else if path.status == .unsatisfied {
  10.                 print("Not Connected")
  11.             }
  12.         }
  13.         monitor.start(queue: queue)
  14. }
  15.  
  16. override func viewWillDisappear(_ animated: Bool) {
  17.                 monitor.cancel()
  18.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top