Hi. how do I detect map drag events on iOS?
# compose-ios
g
Hi. how do I detect map drag events on iOS?
I have this code currently for iOS target. Just one last functionality I need is to listen when user drags the map
Copy code
UIKitView(
        factory = {
            MKMapView().apply {
                showsCompass = false
                delegate = object : MKMapViewDelegateProtocol, NSObject() {
                    override fun mapView(
                        mapView: MKMapView,
                        viewForAnnotation: MKAnnotationProtocol
                    ): MKAnnotationView? {
                        return mapView.dequeueReusableAnnotationViewWithIdentifier("pin")
                            ?: MKAnnotationView(viewForAnnotation, "pin").apply {
                                image = UIImage.imageNamed("custom_pin")
                            }
                    }
                }
            }
        },
        modifier = modifier,
        update = {
            it.addAnnotation(annotation)
            it.setRegion(
                MKCoordinateRegionMakeWithDistance(
                    centerCoordinate = location,
                    10_000.0, 10_000.0
                ),
                animated = false
            )
        },
        properties = UIKitInteropProperties(
            interactionMode = UIKitInteropInteractionMode.NonCooperative
        )
    )
a
g
thanks that looks promising