Questions tagged [mkmapview]

MKMapView is part of Apple's MapKit framework for developing location-aware iOS applications, and provides an embeddable map interface. Effective iOS 6, the MapKit framework uses Apple's own map service. In iOS 5.1 and earlier, the framework uses the Google Mobile Maps service.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

"Property 'setRegion' not found on object of type MKMapView*" or problem connecting storyboard to the code?

I am developping an ios app with MapKit zoom to user current location on Xcode 14.0. It failed to build. The direct error from xcode is "Property 'setRegion' not found on object of type MKMapView*...
doctor's user avatar
  • 107
0 votes
1 answer
20 views

Determine MapKit tiles for visibleMapRect

I saw simple code for calculating a grid of tile bounds needed for a given MKMapRect but I can't find it now. IIRC it was a function built-in to MapKit. Given a MKMapRect like mapview.visibleMapRect ...
Jeshua Lacock's user avatar
1 vote
0 answers
58 views

MKMapView uses lot of memory and keeps getting crash

I am using Apple Maps to display approximately 2000 annotations and 50 polylines on the mapView. I have also implemented annotation clustering. However, my application is crashing due to high memory ...
Nikhil Mujral's user avatar
0 votes
1 answer
79 views

Swift MapKit custom tiles and polylines break on zooming and moving

I am developing a navigation application that displays custom tiles and multicolour polylines on the map. When the map moves the polylines and the custom tiles break on the edge of the tiles. When the ...
Ákos Morvai's user avatar
2 votes
1 answer
31 views

Display another view when tapping on Annotation

I have created a UIViewRepresantable to display a map in SwiftUI. I want display an overlay displaying information about the annotation to the map, once the annotation is tapped. Inside the ...
FritziBitz's user avatar
0 votes
0 answers
62 views

Swift 5 Map View calloutAccessoryControlTapped view open

I'm looking to open a details view when user clicks on the callout (calloutAccessoryControlTapped func). I'm setting the rightCalloutAccessoryView to a button that i hide and after, inside ...
acronimus's user avatar
1 vote
1 answer
190 views

How to add multiple Pins (MapMarkers) to the Map View?

Im trying to pin the locations on the mapview but the errors keep coming up I tried adding all the PinItem to the annotationItems but that doesn't work struct Store_locator_page: View { struct ...
Gimhan Ariyarathna's user avatar
0 votes
0 answers
45 views

Rendering route polyline using MKMapView with a border iOS Swift

So I can't get the border polyline to be rendered below the main polyline, I am able to do it if I use coordinates but wont work with the route. I need it to be rendered as the route. I'm pretty sure ...
James Meegan's user avatar
0 votes
0 answers
40 views

How to change annotation color with/without shade on iOS16

I have a small problem that the color of spot bubble is darker with shade after updating iOS 16. Is there any idea to return it to the flat color like the image of iOS 15.5 possibly using MKMapView. I ...
Ceesaa's user avatar
  • 1
0 votes
0 answers
34 views

MKMapView zoomed out when setting region programmatically

I am trying to recenter MKMapView to user's current location programmatically. Following is the code for map view recenter. fileprivate func recenterToCurrentLocation() { var userLocation: ...
Pawan Joshi's user avatar
  • 1,581
0 votes
1 answer
69 views

I'm trying to show circleOverlays on an MKMapView however it isn't showing up

The code below is to take a specific number of references from a database, make circle overlays from some coordinates given from some DBSCAN function, and plot the circle overlays on the map. Every 10 ...
user20444988's user avatar
0 votes
1 answer
65 views

How to draw MKPolyline with moving points?

So I have an app which is receiving every second some latitude and longitude data from a websocket. What I'm trying to do is draw a path on my map (MKMapView) every time I receive a new position. The ...
Fred Novack's user avatar
1 vote
1 answer
85 views

Binding array is empty when accessed through Coordinator

I am having an issue with my Coordinator. I am interacting with a MKMapView via SwiftUI. I am passing in a Binding to the UIViewRepresentable and need to access that same Binding in the Coordinator. ...
Obito's user avatar
  • 79
0 votes
0 answers
50 views

How to set a default altitude for MKMapView if MKMapCamera:fromDistance is being ignored?

struct MapViewExample: UIViewRepresentable { let location = CLLocation() func makeUIView(context: Context) -> MKMapView { let mapView = MKMapView() mapView....
netsplatter's user avatar
0 votes
0 answers
91 views

What methods are called after DidSelectAnnotationView/DidDeSelectAnnotationView in MapView in Xamarin iOS?

I'm working on a Xamarin iOS project and have a view with a MapView that contains modified MKAnnotations and implements IMKMapViewDelegate. The view shows a map with a few annotations on the map. ...
Steve W's user avatar
  • 1,118
0 votes
0 answers
43 views

How to select already present places on map using Mapkit ios swift

I want to make my app open another View Controller on the tap of an already present place on the map. When you open a map there are many places shown on map with their names i think they are called ...
Zisf 98's user avatar
0 votes
1 answer
108 views

MapKit show local results without location permission

I am building an uber-like app that shows recommended addresses as the user types. Initially, when I started building the app it prompted for the user's location and the autocomplete was smart because ...
John Citrowske's user avatar
0 votes
1 answer
120 views

How to find closest position on a line from another point

MKMapView - I have a road, consisting of many location points. A line is drawn from each point to the next, making it a visible road line. I have a user location, and I would like to draw a line to ...
Guntis Treulands's user avatar
0 votes
0 answers
99 views

Map view problems

struct SchoolsMap: View { @EnvironmentObject private var newMap : SchoolModel var share = SchoolModel().schools @State private var latitudinal = 0.0 @State private var longitude = 0.0 let pin = ...
Eric Brew's user avatar
1 vote
2 answers
216 views

Adding over 14000 apple MapKit multipolyline overlays as MKOverlays crashes app

I am trying to add an array of multipolylines as MKOverlay to a map view as show in code below: import SwiftUI import MapKit struct PolylineMapView: UIViewRepresentable { func ...
Heyman's user avatar
  • 449
0 votes
0 answers
68 views

How can I disable auto-zooming when using userTrackingMode?

I am trying to zoom out of a map but it keeps zooming back in because of the .userTrackingMode that is set to .follow. Is there a way to prevent or to write your own tracking mode method? I tried to ...
C Fuchs's user avatar
1 vote
1 answer
548 views

Change maptype based on button selection using MKMapView

So I'm trying to click on a button and change the mapType using the MKMapView API, but I can't seem to achieve it. So here is what I have, we have the MKMapView file: import SwiftUI import MapKit ...
SLE's user avatar
  • 329
0 votes
1 answer
69 views

Check if MKPolygon is inside visible rect or another MKPolygon

I have a MKMapview with lot of polygons added as overlays, To optimize the memory I need to know before adding an overlay if the polygon is inside visible area of the MKMapview I can even create a ...
Kishorekumar E K's user avatar
1 vote
1 answer
307 views

Swift set conditional statement when annotation is tapped on mapView for detail view

I have a mapView with a couple of custom annotations. Now what I want is when I tap an annotation the conditional statement voor showLocation: String is set to a specific value. So for example the ...
Curiousnoes's user avatar
0 votes
0 answers
96 views

MKMapView: Customize Current Location's Avatar View

In recent versions of iOS, sometimes the current user's location (the blue dot) becomes smaller and an "Avatar View" of sorts appears (screenshot below). Is there a way to set a custom view /...
Jake Chasan's user avatar
  • 6,310
0 votes
0 answers
330 views

Swift MapKit annotations slow annotation loading

I've over 1000 different annotations that are shown on a MKMapView and depending on where the user is (visibleMapRect) loads in a new set of annotations based on region.center. The problem I'm facing ...
Warve's user avatar
  • 471
0 votes
1 answer
71 views

Custom MKOverlay & Renderer draw not working

I'm attempting to create a custom overlay for MKMapView which varies the colour of the polyline according to certain criteria. However, none of my drawing code works, & I can't for the life of me ...
SomaMan's user avatar
  • 4,127
3 votes
1 answer
694 views

UIViewRepresentable - MKMapView doesn't get updated

I'm dealing with an app where I have to embed a MKMapView (UIKit) into a SwiftUI View. Unfortunately I can't use the implemented Map of SwiftUI, because I have to support clustering (which Map can't ...
finebel's user avatar
  • 2,237
-1 votes
1 answer
53 views

Find direction(clockwise anti-clockwise) MKPolyline drawn on MKMapView

I am using MKPolylineRenderer to render series of polylines. I am facing challenge with deciding clockwise/anticlockwise direction of its drawing on map. I tried my best put my issue. I am attaching ...
Santosh Singh's user avatar
3 votes
1 answer
396 views

How to Update Annotation Coordinates on MapView

I have a mapView and vehicle coordinates which changes in every 15 seconds so I want to update the coordinates. My current approach is to delete all annotations and adding new ones. However, I can't ...
Emirhan Karahan's user avatar
0 votes
1 answer
203 views

Disable DoubleTapGesture Zoom out on MKMapView

I have observed MKMapView zoom-out on Double tap gesture, I didn't find any way to disable it. I tried to add own Double Tap Gesture to catch Double tap action but it still zoom out. Any thought?
Santosh Singh's user avatar
1 vote
0 answers
95 views

Xcode MapKit App Project - images switch when zooming, rotating, and moving on map

We are building a mapkit iOS application where we are using custom annotations to put specific information about our school buildings on map pins. When the app and map first loads, everything works ...
Drew's user avatar
  • 11
0 votes
1 answer
362 views

How to combine UIViewRepresentable and instance methods for Mapkit?

For an app I need to display a Map from mapkit. I'm using SwiftUI. On top of the Map itself there need to be a search function and when you finish the search (enter) the map moves the visible region ...
Peter Van de Put's user avatar
0 votes
1 answer
52 views

Why would MKMapView not add new annotations from Firestore data?

I am using an MKMapView wrapped in UIVIewRepresentable under SwiftUI to display various locations on the map. The data is fetched from a Google Firestore collection and annotations added to the map ...
user avatar
-1 votes
2 answers
324 views

How to show in which side user turn phone, if I show user location using MKMapView

I want to show into which side the user turns the phone, like on MapView, and can't understand how to do that, I have tried to use these options, but they can't help me: mapView.showsUserLocation = ...
Ice's user avatar
  • 690
0 votes
1 answer
712 views

How to detect taps on MKMapView but ignore taps on MKAnnotationViews

I'm writing an iOS app where the user taps on an MKMapView to drop a pin (MKAnnotationView subclass), and taps an existing pin to delete it. Adding new pins and deleting old ones is working, but the ...
paulopadopalos's user avatar
1 vote
2 answers
368 views

ype 'MapView' does not conform to protocol 'UIViewRepresentable'

In a clean demo project I've created a MapView which is UIViewRepresentable and it all works great. It reads a geojson file with a polygon and draws it on the map. When I copy this exact code to my ...
Peter Van de Put's user avatar
0 votes
0 answers
51 views

Detect when all the annotations have been successfully been drawn or added to MKMapView

I posted another question about MKMapView today. The code is actually the same one, so if you need to see it, it's here: How to get the MKMapView instance from my UIViewRepresentable view?. In the ...
TigrouMeow's user avatar
  • 3,679
1 vote
1 answer
179 views

How to get the MKMapView instance from my UIViewRepresentable view?

I am using MapView this way (the code is of course simplified): struct IkMapView: UIViewRepresentable { var mapView = MKMapView() func makeUIView(context: Context) -> MKMapView { mapView....
TigrouMeow's user avatar
  • 3,679
0 votes
1 answer
781 views

SwiftUI - MKMapView - Display map center coordinate in a @EnvironmentObject variable

can someone please help me with my problem? I have a SwiftUI Project and wrote a MKMapView File. I would like to store the Center coordinates in a @EnvironmentObject variable. Unfortunately, I can't ...
csajko's user avatar
  • 3
0 votes
1 answer
684 views

How to properly allocate/initialize a weak variable? (Swift)

I'm trying to get rid of a memory leak associated with an MKMapView. I think the main problem is that I created my entire project without using storyboard as a series of views which I manage by either ...
jmsapps's user avatar
  • 398
1 vote
1 answer
610 views

Adding Overlay to MKMapView using OpenWeatherMap (Swift)

I have no idea where to begin. Here's the documentation: https://openweathermap.org/api/weathermaps Following that, and searching what I could online I tried the following, but it gives me a fatal ...
jmsapps's user avatar
  • 398
1 vote
1 answer
884 views

Get API Coordinates and Show city in SwiftUI

I call an API and get a response with a longitude and latitude. Now, I'm trying to show and update the city name. I made a function ("place") to convert the longitude and latitude to a city ...
SoftGuru's user avatar
0 votes
1 answer
144 views

How to Share 1 MapView in all Project Swift 5

I wanted to know if it was possible to share the same MKMapView variable in the whole project. Since creating multiple instances is increasing memory considerably. As soon as I open a new view ...
nacho1111's user avatar
0 votes
1 answer
135 views

Overriding MKMapView scroll/pan has very poor performance

I want to restrict the panning of an MKMapView to horizontal/longitude scrolling only. I set the latitude I want to keep in a var: var currentLatitude: CLLocationDegrees? Then I override the ...
Darren's user avatar
  • 10.2k
0 votes
1 answer
279 views

Show two annotation on Xamarin iOS Map simultaneously

I know, Since I joined StackOver Flow, I am asking regular question, but understand me I in such circumstances where I could get any work around of my issues. I have situation where On Current Lat-...
Kettan Sinha's user avatar
1 vote
0 answers
749 views

How can I set `mapType` in a MapKit Map in SwiftUI so it can appear as a 3D globe?

How can I set mapType in a MapKit Map in SwiftUI so it can appear as a 3D globe? I'm looking for a way to set mapType to .hybridFlyover: mapview.mapType = MKMapType.hybridFlyover But for SwiftUI: ...
Jordan Trana's user avatar
  • 1,486
0 votes
1 answer
93 views

Timer is not allowing to add annotation on mapView in iOS swift

I have a situation where I have to call an API to fetch some Vehicles Locations objects in an array after getting the user current location. After fetching vehicles, I have to get the address also ...
user1960279's user avatar
0 votes
0 answers
138 views

iOS MKMapView how to stop scrolling/moving while user pinching to zoom in

I have added a UIPinchGestureRecognizer to handle zoom in / out. But while doing so map also starts moving and scrolling. How to ignore this pan/scroll during pinching and catch only while user ...
Praful Kadam's user avatar
7 votes
0 answers
336 views

Custom user picture for default User Location's callout on MKMapView

On iOS 15 (actually since iOS 14), on a MKMapView when tapping on the default User Location a callout is shown displaying kind of an 'empty' profile picture. You can see on the screenshot below the ...
vicegax's user avatar
  • 4,819

1
2 3 4 5
100