Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Added methods to README #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,35 @@ A simple class to check for internet connection availability in Swift. Works for
##### Manually
-

## Checking internet connection
``` swift
let status = Reach().connectionStatus()
switch status {
case .Unknown, .Offline:
print("Not connected")
case .Online(.WWAN):
print("Connected via WWAN")
case .Online(.WiFi):
print("Connected via WiFi")
}
```

## Delegate Method
``` swift
override func viewDidLoad() {
super.viewDidLoad()

NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("networkStatusChanged:"), name: ReachabilityStatusChangedNotification, object: nil)
Reach().monitorReachabilityChanges()
}

func networkStatusChanged(notification: NSNotification) {
let userInfo = notification.userInfo
print(userInfo)
}
```



## Credits

Expand Down