IOS MKMapView capture click event on MKPointAnnotation #3264
Replies: 3 comments 8 replies
-
Yes, you can handle events on MKMapView. |
Beta Was this translation helpful? Give feedback.
-
OK, thank you for the suggestion! I actually tried this early in my discovery phase, but abandoned it because although it compiles with odd warnings, I got stuck with weird run-time issues. Like map doesnt render, callbacks are not fired, and not able to implement more than on method in the delegate... maybe this is just not yet possible, or no one has tried yet? It seems to be directly related to the iOS code for the interfaces to native iOS functions, and maybe this is not setup properly? Here is my Github project if you want to look at my code: https://github.com/realityexpander/ContactsComposeMultiplatform The Compose code in the I am running Android Studio Hedgehog | 2023.1.1 Beta 6 patch 2. I am finally able to compile and build, but i'm not able to override/implement more than one function in the delegate... I think this is an issue that can only be solved by addressing the interfaces defined in // ...
@kotlin.commonizer.ObjCCallable public open expect fun mapView(mapView: platform.MapKit.MKMapView, didSelectAnnotationView: platform.MapKit.MKAnnotationView): kotlin.Unit { /* compiled code */ }
@kotlin.commonizer.ObjCCallable public open expect fun mapView(mapView: platform.MapKit.MKMapView, didDeselectAnnotation: platform.MapKit.MKAnnotationProtocol): kotlin.Unit { /* compiled code */ }
... Right now, you cannot define more than one override in the delegate: It seems that the compiler/interface defintions are not allowing for more than one type as the second parameter... IE: you can only have one Also, these functions are not being called in response to events. Works fine in regular SwiftUI. Also overriding some functions (i tried I'm currently leaning on that this is just not possible yet, the plaform team at IntelliJ needs to address this issue. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I've just hit this issue. Is there any guidance on how to override Objective-C methods from Kotlin? |
Beta Was this translation helpful? Give feedback.
-
Hello all, i'm using the code example present on github, which explains how to use maps on IOS with compose multiplatform,
Analyzing the UIKitView to show the MKMapView, I would like to know if there is a possibility to capture the MKPointAnnotation Tap event, to then show, once the markers on the map have been pressed, my custom screen above the Map.
Thanks to whoever will answer me
Beta Was this translation helpful? Give feedback.
All reactions