Преглед на файлове

Merge pull request #51 from hkellaway/patch-1

Updated README for Swift 2.0
Ashley Mills преди 10 години
родител
ревизия
8a2c1cbb73
променени са 1 файла, в които са добавени 11 реда и са изтрити 11 реда
  1. 11 11
      README.md

+ 11 - 11
README.md

@@ -34,34 +34,34 @@ Just drop the **Reachability.swift** file into your project. That's it!
 ````
 ````
     let reachability = Reachability.reachabilityForInternetConnection()
     let reachability = Reachability.reachabilityForInternetConnection()
 
 
-    reachability.whenReachable = { reachability in
+    reachability?.whenReachable = { reachability in
         // keep in mind this is called on a background thread
         // keep in mind this is called on a background thread
         // and if you are updating the UI it needs to happen
         // and if you are updating the UI it needs to happen
         // on the main thread, like this:
         // on the main thread, like this:
         dispatch_async(dispatch_get_main_queue()) {
         dispatch_async(dispatch_get_main_queue()) {
             if reachability.isReachableViaWiFi() {
             if reachability.isReachableViaWiFi() {
-                println("Reachable via WiFi")
+                print("Reachable via WiFi")
             } else {
             } else {
-                println("Reachable via Cellular")
+                print("Reachable via Cellular")
             }
             }
         }
         }
     }
     }
-    reachability.whenUnreachable = { reachability in
+    reachability?.whenUnreachable = { reachability in
         // keep in mind this is called on a background thread
         // keep in mind this is called on a background thread
         // and if you are updating the UI it needs to happen
         // and if you are updating the UI it needs to happen
         // on the main thread, like this:
         // on the main thread, like this:
         dispatch_async(dispatch_get_main_queue()) {
         dispatch_async(dispatch_get_main_queue()) {
-            println("Not reachable")
+            print("Not reachable")
         }
         }
     }
     }
 
 
-    reachability.startNotifier()
+    reachability?.startNotifier()
 ````
 ````
 
 
 and for stopping notifications
 and for stopping notifications
 
 
 ````
 ````
-reachability.stopNotifier()
+reachability?.stopNotifier()
 ````
 ````
 
 
 ## Example - notifications
 ## Example - notifications
@@ -76,7 +76,7 @@ This sample will use `NSNotification`s to notify when the interface has changed.
                                                      name: ReachabilityChangedNotification, 
                                                      name: ReachabilityChangedNotification, 
                                                      object: reachability)
                                                      object: reachability)
     
     
-    reachability.startNotifier()
+    reachability?.startNotifier()
 ````
 ````
 
 
 and
 and
@@ -88,12 +88,12 @@ and
 
 
         if reachability.isReachable() {
         if reachability.isReachable() {
             if reachability.isReachableViaWiFi() {
             if reachability.isReachableViaWiFi() {
-                println("Reachable via WiFi")
+                print("Reachable via WiFi")
             } else {
             } else {
-                println("Reachable via Cellular")
+                print("Reachable via Cellular")
             }
             }
         } else {
         } else {
-            println("Not reachable")
+            print("Not reachable")
         }
         }
     }
     }
 ````
 ````