How to set MGLAnnotationView as sourceView for popover
<p>What I want to do is <strong>present a popover with the annotation as its source view/anchor</strong></p>

<p>By using delegate function <strong>didSelect annotationView</strong> I should be able to achieve this, but it doesn't seem to run at all.
For now I'm just presenting my popover via <em>didSelect annotation</em> and have set the sourceView to nav bar, just for showing it somewhere...</p>

<p>FYI:
I have implemented the <strong>Mapbox SDK</strong> into the project.
I have no problems performing the same task using MapKit.</p>

<p><strong><em>Does anyone have any idea on what I can do to achieve this?</em></strong></p>

<p>code snippets below:</p>

<pre><code>import UIKit
import Mapbox

class ViewController: UIViewController, MGLMapViewDelegate, UIPopoverPresentationControllerDelegate {

@IBOutlet var theMap: MGLMapView!

override func viewDidLoad() {
    super.viewDidLoad()

    theMap.delegate = self

    let point = MGLPointAnnotation()
    point.coordinate = CLLocationCoordinate2D(latitude: 55.6, longitude: 13.0)
    point.title = "Some place"
    point.subtitle = "Malmö, Sweden"
    theMap.addAnnotation(point)
}

func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView) {
    print("annotation view: ", annotationView)
    // this method doesn't seem to get called at all...
    // but ideally this is the place to present the popover.
}

func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {
    print("annotation: ", annotation)
    // present the popover
    presentPopover()
}

func presentPopover(){
    let popover = storyboard?.instantiateViewController(withIdentifier: "MyCalloutVC") as! MyCallout

    popover.modalPresentationStyle = UIModalPresentationStyle.popover
    popover.popoverPresentationController?.backgroundColor = UIColor.white
    popover.popoverPresentationController?.delegate = self

    // I would like to set the source anchor to the selected annotation view.
    popover.popoverPresentationController?.sourceView = UINavigationBar() // set to nav bar for now...
    popover.popoverPresentationController?.permittedArrowDirections = .any
    // popover size set in MyCallout 
    self.present(popover, animated: true)
    }
}
</code></pre>