MapKit pin dragging question

I'm not sure what I'm doing wrong or failing to do, but I can't get a map pin annotation to drag. Instead I'm dragging the entire map.


Pin is created and placed on a map using this code:


           mapPin = MKPointAnnotation()
           if let pin = mapPin {
               pin.coordinate = location;
               pin.title = "location"
               mapView.addAnnotation(pin)
           }


This MKMapViewDelegate function is called to create the annotationView


  func mapView(_ mapView: MKMapView,
                viewFor annotation: MKAnnotation) -> MKAnnotationView? {

       let identifier = "pinAnnotation"
       var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKPinAnnotationView
       if (annotationView == nil) {
           annotationView = MKPinAnnotationView(annotation: annotation,
                                                reuseIdentifier: identifier)
           if let av = annotationView {
               av.pinColor = .red;
               av.animatesDrop = false
               av.canShowCallout = false
               av.isDraggable = true
           } else {
               unexpected(error: nil, "Can't create MKPinAnnotationView")
           }
       } else {
           annotationView!.annotation = annotation
       }
       return annotationView
   }


However, a breakpoint on the the delegate function that should be called durring a drag operations is never triggered and instead of dragginng the pin, the entire map is panned.


   // A pin is being dragged.
   func mapView(_ mapView: MKMapView,
                annotationView view: MKAnnotationView,
                didChange newState: MKAnnotationViewDragState,
                fromOldState oldState: MKAnnotationViewDragState) {
  // ...
  }


What did I forget?


High Sierra (10.13)

Xcode 9.0.1 (9A1004)

I'm attempting to drag using a three finger gesture on a tablet.

Did you set the MKMapView delegate? Also, the default drag behavior uses only 1 finger.

Yes, the delegate is set. I don't think mapView(_, viewfor) is called, otherwise. In any case I added mapView(_, didSelect) as a test and verified it is called.


One finger? On a trackpad without using clicks (my trackpad is a wacom)? Three fingers is the same as dragging 1 figer with a physical click. But just to check let me put some batteries in a mouse and test.... Even with a mouse putting the curson upon a pin and click/dragging drags the underlying map, not the pin. But if I hold the mouse steady and hold the click the pin bounces once, but does not move when I drag. In that situation the map doesn't move, either.

MapKit pin dragging question
 
 
Q