Reputation: 3
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")
}
}
Upvotes: 0
Views: 154
Reputation: 841
Replace in your code: func fetchWeather(latitude: CLLocaitonDegress, longitude: CLLocationDegrees)
with this:
func fetchWeather(latitude: CLLocationDegrees, longitude: CLLocationDegrees)
Upvotes: 2
Reputation: 664
You need to add import CoreLocation under import UIKit
import UIKit
import CoreLocation
Upvotes: 0