Skip to content

MKAnnotationView for MapKit does not work in Kotlin Multiplatform iOS #4497

Answered by realcbnewham
realcbnewham asked this question in Q&A
Discussion options

You must be logged in to vote

To answer my own question - as I was not familiar with how the annotations work as I'm from the Google Maps world, the map requires a delegate in order to show custom markers. And I thought Google Maps was weird. But I digress.

Bizarrely many of the functions in the delegate are overloaded with the same name and parameter types, although different parameter names. This produces an error in the IDE because of function ambiguity, but the code still compiles and runs. This threw me for a long time.

If anyone alights on this in search of an answer, you need a delegate for the map:

class MVD() : NSObject(), MKMapViewDelegateProtocol {

    @OptIn(ExperimentalForeignApi::class)
    override fun…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by realcbnewham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant