First Insert Pod
pod 'ReachabilitySwift'
Add This Function In Your View Controller File
//MARK:- Network reachablity
@objc func reachabilityChanged() -> Bool
{
let reachability : Reachability = Reachability()!
switch reachability.connection
{
case .wifi:
print("Reachable via WiFi")
return true
case .cellular:
print("Reachable via Cellular")
return true
case .none:
print("Network not reachable")
return false
}
}
Check Connection
let IsConnection = self.reachabilityChanged()
if (IsConnection)
{
self.GetUserBankAccountServiceCall()
}
else
{
self.showAlert(AppName, msg:"no Internet Connection", dismissBtnTitle: OK)
}
No comments:
Post a Comment