How to check internet connection in alamofire?
For swift 5 and Alamofire 5.4.4 ,I created a swift class called Connectivity . Use NetworkReachabilityManager class from Alamofire and configure the isConnectedToInternet() method as per your need. import Foundation import Alamofire class Connectivity { class func isConnectedToInternet() -> Bool { return NetworkReachabilityManager()?.isReachable ?? false } } Usage: if Connectivity.isConnectedToInternet() { print(“Yes! internet is available.”) … Read more