December 2018
Intermediate to advanced
414 pages
10h 19m
English
class LocationAware: NSObject { let manager = CLLocationManager() override init() { super.init() manager.delegate = self }}
Then, we need to mark LocationAware as being CLLocationManagerDelegate. Delegation uses protocols to ensure the methods that may be called are properly implemented on the delegate:
extension LocationAware: CLLocationManagerDelegate { func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { // do something with the updated location } /* more delegation methods */}
Now, with that example in mind, let's create our own delegation pattern that will facilitate communications ...
Read now
Unlock full access