We are just about done refactoring our files. The last file we need to refactor is our MapViewController. Let's get started:
- Inside of our MapViewController, after the last curly brace, hit enter a couple of times and add the following code (remember, this should be outside of the class, not inside):
// MARK: Private Extensionprivate extension MapViewController {} // MARK: MKMapViewDelegate extension MapViewController: MKMapDelegate {}
- Next, remove the MKMapViewDelegate subclass from the main class and move it into our extension.
- Now, let's move all of our MKMapViewDelegate methods into the extension. You should be moving the following:
Your extension should now look as follows:
- Next, let's update our ...