Ver código fonte

Add logging to sample code

Ashley Mills 10 anos atrás
pai
commit
ad6a0d1bae
1 arquivos alterados com 5 adições e 0 exclusões
  1. 5 0
      ReachabilitySample/ViewController.swift

+ 5 - 0
ReachabilitySample/ViewController.swift

@@ -35,6 +35,9 @@ class ViewController: UIViewController {
     func setupReachability(useHostName useHostName: Bool, useClosures: Bool) {
         let hostName = "google.com"
         hostNameLabel.text = useHostName ? hostName : "No host name"
+        
+        print("--- set up with host name: \(hostNameLabel.text!)")
+
         do {
             let reachability = try useHostName ? Reachability(hostname: hostName) : Reachability.reachabilityForInternetConnection()
             self.reachability = reachability
@@ -57,6 +60,7 @@ class ViewController: UIViewController {
     }
     
     func startNotifier() {
+        print("--- start notifier")
         do {
             try reachability?.startNotifier()
         } catch {
@@ -67,6 +71,7 @@ class ViewController: UIViewController {
     }
     
     func stopNotifier() {
+        print("--- stop notifier")
         reachability?.stopNotifier()
         NSNotificationCenter.defaultCenter().removeObserver(self, name: ReachabilityChangedNotification, object: nil)
         reachability = nil