The mapTypeChanged function has been defined inside the loadView function.
override func loadView() {
    ...
    func mapTypeChanged(_ segControl: UISegmentedControl) {
       ...
    }
    ...
}
Make the mapTypeChanged function, just like the loadView, a method of the MapViewController class.