Search code examples
swiftcllocationmanagerswift5cllocation

swift5 Use of undeclared type 'CLLocaitonDegress'


I am tried to get value of latitude, longitude from my app . but there is some error with "Use of undeclared type 'CLLocaitonDegress'" this message.. I don't understand what happend to my code ??

func fetchWeather(latitude: CLLocaitonDegress, longitude: CLLocationDegrees) {
        let urlString = "\(weatherURL)&lat=\(latitude)&lon=\(longitude)"
        performRequest(urlString: urlString)
    }

//MARK: -CLLocationManagerDelegate

extension WeatherViewController: CLLocationManagerDelegate {
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        if let location = locations.last {
            let lat: Double = location.coordinate.latitude
            let lon: Double = location.coordinate.longitude
            weatherManager.fetchWeather(cityName: String, latitude: lat, longitude: lon)
        }
    }
    
    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
        print("error")
    }
    
}



Solution

  • Replace in your code: func fetchWeather(latitude: CLLocaitonDegress, longitude: CLLocationDegrees)

    with this:

    func fetchWeather(latitude: CLLocationDegrees, longitude: CLLocationDegrees)