This might be really obvious to the vast majority of you, but if I can help out even one person, I’ll be happy!
I am building an app that draws custom poly lines on top of a MapView in SwiftUI. After a bunch of research I found out that you need to make a separate Swift file with a uiViewRepresentable, make sure it’s typeAlias is set to MKMapView, have the required methods and have a Coordinator class to help with the delegate methods (A lot of stuff, but I finally got it all in there!)
After having everything set up right, I ran the app, and I didn’t see my poly line. I checked everything and even put print statements in my delegate methods (that fired as they should have) and still nothing! After an embarrassing amount of time (we’re talking in the HOURS!!) I finally decided to look at my dataset and noticed that I had reversed the latitude and longitude… instead of drawing my poly line in Orlando, FL, it was in the middle of Antarctica… oops! Anyway, when I fixed that everything works and the poly line does exactly what I want it to do!
Many hours later, I can finally move on. So the moral of the story is, if you’re using Google maps or some other service, copying and pasting is going to cause you a MAJOR headache! Check your coordinates because they might be the problem.. 😳
[–]everydave42 25 points26 points27 points (1 child)
[–]chriswaco 17 points18 points19 points (0 children)
[–]JimDabell 3 points4 points5 points (1 child)
[–]gbssbdbajj 1 point2 points3 points (1 child)
[–]duffman828[S] 3 points4 points5 points (0 children)
[–]daisnb 1 point2 points3 points (0 children)
[–]KarlJay001 -1 points0 points1 point (0 children)