I have started a new project with KMM(Kotlin multiplatform). I need to use the original IOS map (MKMapView) in my project. According to the instructions of this article integrating-mapkit-in-compose-multiplatform-part-2 I was able to add all the things I needed to the program. But I have a problem, and that is that I cannot find any solution for get the user clicking point from the map. Is there anyone who has been able to do this? I also tried the UIGestureRecognizer or UITapGestureRecognizer event, but it didn't work.
class GestureDelegate :
NSObject(),
UIGestureRecognizerDelegateProtocol {
override fun gestureRecognizer(
gestureRecognizer: UIGestureRecognizer,
shouldReceiveTouch: UITouch
): Boolean {
println("Tap")
return true
}
}
UIKitView(
modifier = Modifier.fillMaxSize(),
factory = {
mkMapView.apply {
userInteractionEnabled = true
val panGesture = UIGestureRecognizer(target = this, action = NSSelectorFromString("handleTap:"))
panGesture.delegate = GestureDelegate()
this.addGestureRecognizer(panGesture)
}
},
}