TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Map Markers to Screen Coordinates

Forums > SwiftUI

I am experimenting with drawing markers on a SwiftUI Map to items in a list below it. Am I running up against a SwiftUI limitation with Map from MapKit where I cannot convert a location on the map into screen coordinates? It kinda looks like there is "a way" to do it in UIKit but unfortunately I do not speak UIKit (and I lost track of the link to where I saw that).

I can approximate the effect I want using linear interpolation across the map region (from lat delta, lon delta, and center) and it looks fine in longitude but the projection is causing some walking in the latitude direction. It goes from bad to horrible if I zoom out to see most of the world. I have also tried converting the MKMapRegion to MKMapRect so that I can do the interpolation with x an y from MKMapPoints converted to screen points by also knowing the Map view size but I get about the same result here.


Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.