Macvin
Macvin

Reputation: 3

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")
    }
    
}


Upvotes: 0

Views: 154

Answers (2)

Massimo Pavanel
Massimo Pavanel

Reputation: 841

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

with this:

func fetchWeather(latitude: CLLocationDegrees, longitude: CLLocationDegrees)

Upvotes: 2

Alexander Nikolaychuk
Alexander Nikolaychuk

Reputation: 664

You need to add import CoreLocation under import UIKit

import UIKit
import CoreLocation

Upvotes: 0

Related Questions