From Apple's documentation:
Responding to Location Events
func locationManager(CLLocationManager, didUpdateLocations: [CLLocation])
Tells the delegate that new location data is available.
func locationManager(CLLocationManager, didFailWithError: Error)
Tells the delegate that the location manager was unable to retrieve a location value.
func locationManager(CLLocationManager, didFinishDeferredUpdatesWithError: Error?)
Tells the delegate that updates will no longer be deferred.
func locationManager(CLLocationManager, didUpdateTo: CLLocation, from: CLLocation)
Tells the delegate that a new location value is available.
I have a piece of my code which looks like:
ViewController.swift
class ViewController:UIViewController, CLLocationManagerDelegate {
[...]
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
[...]
}
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
[...]
}
[...]
}
How can I have in the same class, two functions that have the same name but are called in independent ways depending on the arguments passed? In other programming languages, afaik you can't do that.