Search code examples
iosswiftoperator-overloadingreachability

Swift error: Could not find an overload for '==' that accepts the supplied arguments?


Actually Iam checking for internet connection in my code and i get a weird error "Could not find an overload for '==' that accepts the supplied arguments"

Here is my code snippet,

override func viewDidLoad() {
        super.viewDidLoad()

        checkkNetworkStatus()

        let requestURL = NSURL(string: "http://example")

        let request = NSURLRequest(URL: requestURL!)

        webView.loadRequest(request)

    }


func checkkNetworkStatus(){

        let networkChecking : Reachability = Reachability.reachabilityForInternetConnection()

        networkChecking.startNotifier()

        var status : NetworkStatus = networkChecking.currentReachabilityStatus()

        if (status == NotReachable)   ***//error***
        {
            // statement
        }

}

Solution

  • You can do if (status == .NotReachable) or if (status == NetworkStatus.NotReachable).