I am rewriting my existing Objective-C code (iOS) to Swift and now am facing some issues with the Reachability class of Apple for checking network availability.
Simply use like this
do {
let reachability: Reachability = try Reachability.reachabilityForInternetConnection()
switch reachability.currentReachabilityStatus{
case .ReachableViaWiFi:
print("Connected With wifi")
case .ReachableViaWWAN:
print("Connected With Cellular network(3G/4G)")
case .NotReachable:
print("Not Connected")
}
}
catch let error as NSError{
print(error.debugDescription)
}