Before anyone says inheritance.. hear me out first.
I have 2 totally unrelated view controllers. They each have an MKMapView
. I would like both of them to conform to and implement the same delegate methods.
For example, I want both to implement:
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
let polyline = overlay as! MKPolyline
let renderer = MKPolylineRenderer(polyline: polyline)
renderer.strokeColor = UIColor.red
renderer.lineWidth = 4
return renderer
}
Again, these 2 view controllers aren't related at all, so I don't want to make a base class. As a matter of fact, these 2 view controllers are already inheriting from their respective inheritance hierarchy.