Display map or satellite imagery from your app's interface, call out points of interest, and determine placemark information for map coordinates using MapKit.

Posts under MapKit tag

111 Posts

Post

Replies

Boosts

Views

Activity

`onTapGesture` not triggered on `Map` views
When building with iOS 26 SDK beta 5 (23A5308f), onTapGesture is no longer being triggered on Map views. This appears to be a regression in beta 5 specifically, as this issue was not present in beta 4. How to reproduce Code The following code demonstrates the issue, as seen in the videos below. import MapKit import SwiftUI struct ContentView: View { @State private var location = CGPoint.zero var body: some View { Map() .onTapGesture { location in self.location = location } .safeAreaInset(edge: .bottom) { VStack(alignment: .center) { Text("iOS \(UIDevice.current.systemVersion)") .font(.largeTitle) Text("Tapped Location") Text("\(location.x), \(location.y)") } .frame(maxWidth: .infinity, alignment: .center) .background(.background) } } } Demo The gifs below show the behavior in iOS 18.5 (in which the tap gestures are recognized and tapped coordinate is displayed in the safe area inset) and iOS 26 beta 5 (in which the tap gestures have no effect): iOS 18 iOS 26 Next steps? Is there a recommended workaround for this issue?
18
4
467
2d
Placemark Deprecated
"Use location, address and addressRepresentations instead" Is it possible to know what kind of "Address" a MapItem is representing (State, County, Neighborhood etc) after a MKGeocodingRequest? Is it possible to find out the CLRegion or similar of an map item. (Now when we cannot read it from the Placemark)
2
1
84
6d
Country from MKReverseGeocoding
As GeoCoder is now deprecated I am struggling to get the country only information from the new MKReverseGeocoding. Maybe someone can guide me or give me direction? Or is this just not possible anymore? let request = MKReverseGeocodingRequest(location: self.lastLocation ?? fallbackLocation) request?.getMapItems { items, error in guard let items = items else { return } self.cityName = items.first?.addressRepresentations?.cityWithContext ?? "" self.countryName = items.first?.addressRepresentations?.regionName ?? "" } I couldn't find anything here, sure you can get the full Address but I need single values to store so the user can search for (example City, Country) In case the structure is always the same, let us say the country is always third part, sure I could split the string but it is not a reliable way to do this, at least for me. Any help would be much appreciated.
1
0
79
1w
Apple Map App Crash, when witched to satellite view
hi, When changing the map to Satellite in Apple Maps and centering it on Ōmuta City, Fukuoka Prefecture, Japan (as shown in the image), the app crashes when swiping to the right. This issue also occurs in MapKit, and I confirmed it happens in Apple Maps as well. It seems that either the satellite map tiles are missing or an error is occurring. Our application is experiencing a crash, and this has become a serious issue. Since September 1, crashes have increased significantly. Initially, we suspected that the issue was due to our application’s implementation, but our investigation revealed that the problem lies with the map tiles being called through MapKit. Could you please investigate this issue and provide a fix?
4
0
42
1w
Illegible navigation title when presenting Map view
When building with the iOS 26 SDK (currently beta 4), the navigation title is often illegible when rendering a Map view. For example, note how the title "Choose Location" is obscured by the map's text ("South America") in the screenshot below: This screenshot is the result of the following view code: import MapKit import SwiftUI struct Demo: View { var body: some View { NavigationStack { Map() .navigationTitle(Text("Choose Location")) .navigationBarTitleDisplayMode(.inline) } } } I tried using the scrollEdgeEffectStyle(_:for:) modifier to apply a scroll edge effect to the top of the screen, in hopes of making the title legible, but that doesn't seem to have any effect. Specifically, the following code seems to produce the exact same result shown in the screenshot above. import MapKit import SwiftUI struct Demo: View { var body: some View { NavigationStack { Map() .scrollEdgeEffectStyle(.hard, for: .top) // ⬅️ no apparent effect .navigationTitle(Text("Choose Location")) .navigationBarTitleDisplayMode(.inline) } } } Is there a recommended way to resolve this issue so that the navigation title is always readable?
4
3
180
3w
MapKit MapReader Not working on iOS 26
I have the following code snippet with a simple map and map reader that shows a pin on the map when the user selects a location struct MapReaderTest: View { @State private var loc: CLLocationCoordinate2D? = nil var body: some View { MapReader { proxy in Map { UserAnnotation() if let loc { Marker(coordinate: loc, label: { Text("Marker") }) } } .onTapGesture { position in let position = proxy.convert(position, from: .local) loc = position } } } } This snippet compiles and works perfectly fine using Xcode version 16.4 building for iOS 18.0 and running on a device. This snippet also works for me when I build using Xcode 26 Beta and run in the canvas or simulator, however it does not work when I compile using Xcode 26 and run it on a physical device(I built and tested for both iOS 18.6 and iOS 26 Beta) Has anyone else had a similar issue / have any ideas for work arounds?
1
0
79
3w
Incorrect position rendering of WGS84 coordinate in MKMapView: Discrepancy between Apple Maps (Hong Kong) and Amap (Mainland China)
I am encountering a coordinate rendering issue using MKMapView in my iOS app. I have a GPS coordinate in WGS84 format, which corresponds to a location in Hong Kong. When my device is physically located in Hong Kong, MKMapView displays the map with the "Apple Maps" label, and the WGS84 coordinate is rendered at the correct position. However, when the device is in Mainland China, MKMapView switches to display "Amap" (Gaode Maps) branding, and the same WGS84 coordinate is rendered at an incorrect position. I understand that Amap in Mainland China uses the GCJ-02 coordinate system, while Apple Maps typically uses WGS84. This discrepancy suggests a potential coordinate system mismatch, but I cannot definitively confirm which map type (and corresponding coordinate system) MKMapView is actually using in different regions. My key questions are: How can I programmatically or visually confirm the underlying map type (Apple Maps vs. Amap) and its coordinate system within MKMapView? Is there a way to simulate the Apple Maps environment for testing when physically located in Mainland China?
2
0
78
4w
How to Start with Default Apple Maps Functionality in iOS 18+
Hi everyone, I’m building an iOS 18+ app in Xcode where Apple Maps is central. My goal is to start with the default Apple Maps experience (map view, search bar, pins, directions sheet, etc.) and then customize it for my project. I tried coding it from scratch using MapKit and SwiftUI, but I wasn’t able to get full parity with the basic features of the Maps app. My questions: Is there any sample project, template, or reference that provides the default Apple Maps functionality (views + interactions) as a baseline? Can I copy these into my Xcode project and then extend/customize them? If not, what’s the recommended best practice to get as close as possible to the native Maps app before adding my own features? Any guidance, sample code, or documentation links would be greatly appreciated.
1
0
96
Aug ’25
Quick Look Extension does not load MapKit map properly anymore, after macOS Sequoia
It appears that starting with macOS Sequoia, Quick Look Preview extension no longer loads MapKit maps correctly anymore. Map tiles do not appear, leaving users with a beige background. Users report that polylines do render correctly, but annotations appears black. This was previously working fine in prior macOS versions including Sonoma. STEPS TO REPRODUCE Create a macOS app project, with an associated document. Ensure project has a Quick Look preview extension, with necessary basic setups. Ensure that the extension mentioned in (2) must have a MKMapView. Any other cosmetic changes, etc, does not need to be implemented to observe the base issue. Do note that it has been reported that in addition to the map tiles not loading, annotations don't render correctly as well.
3
2
792
Aug ’25
MKReverseGeocodingRequest and CNPostalAddress from MKMapItem
My app is currently using CLGeocoder to get a CLPlacemark, then using placemark.postalAddress with CNPostalAddressFormatter to get an attributed string for the full address, I then enumerate its attributes to pull out specific elements like just the street or state or zip etc. This is deprecated in iOS 26 with MKReverseGeocodingRequest being the intended replacement. This API returns an MKMapItem which doesn’t provide a CNPostalAddress - you can get a full address as a String but not structured address data that I’m seeing. Am I missing some way to get the postal address? Or is it a non-goal to provide that anymore? Thanks!
5
0
109
Aug ’25
SwiftUI & Xcode 26.0 beta3: Using Map in LazyVGrid causes "Observation tracking feedback loop"
The following code causes an error in Xcode 26.0 beta3 in iOS Simulator with iOS 26.0. After starting the App, scroll to the end of the grid and the app will break. Testet with Xcode Playground with platforms: [ .iOS("17.0")], Simplest possible variant: import SwiftUI import MapKit struct ContentView: View { var body: some View { NavigationStack { ScrollView { LazyVGrid(columns: [GridItem()]) { ForEach(1...12, id:\.self) { i in Text("Hello \(i)") .frame(height: 150) } Map { } .frame(height: 150) } } } } } Thrown error: Observation tracking feedback loop detected! Make a symbolic breakpoint at UIObservationTrackingFeedbackLoopDetected to catch this in the debugger. Refer to the console logs for details about recent invalidations; you can also make a symbolic breakpoint at UIObservationTrackingInvalidated to catch invalidations in the debugger. Object receiving repeated [updateProperties] invalidations: <UIKit.NavigationBarContentView: 0x103026000; frame = (0 0; 402 54); gestureRecognizers = <NSArray: 0x600000c26790>; layer = <CALayer: 0x600000c2d4a0>> contentView=0x0000000103026000 These three nested views are necessary to reproduce the error: NavigationStack -> ScrollView -> LazyVGrid In iOS Simulator with iOS 18.0 there is no error message, the CPU raises to 100%. With Xcode 16.4 the program runs error-free. Is there a solution?
5
1
237
Aug ’25
Reverse geocoding rate limit of MKReverseGeocodingRequest compared to CLGeocoder
The documentation for CLGeocoder states Geocoding requests are rate-limited for each app, so making too many requests in a short period of time may cause some of the requests to fail. (When the maximum rate is exceeded, the geocoder returns an error object with the CLError.Code.network error to the associated completion handler.) And it provides helpful guidance on how and when to submit geocoding requests. The documentation for MKReverseGeocodingRequest does not mention requests are rate-limited. Does this mean it is not rate-limited? If it is rate-limited, is it similar to CLGeocoder, what is its behavior? It is important to understand behavior of the API in order to understand impact on my app’s use case and how users will be affected should I change the implementation. Thanks!
0
0
74
Aug ’25
MapKit Not Updating MapContentBuilder after each mapCameraKeyframeAnimator keyframe
Hello Apple support, I have this following code Map(position: $mCam, selection: $lastSelection) { // Display content conditionally based on camera scope. // ^^^ works with user gesture, does not work with mapCameraKeyframeAnimator } .onMapCameraChange(frequency: .continuous , { context in // save the camera scope }) .mapCameraKeyframeAnimator(trigger: self.trigger, keyframes: { camera in // frames }) Context: when logging, the .onMapCameraChange is updating. The content mapContentBuilder is running. But the content is NOT showing up on the map. MapCircle, MapPolyline does not show! however, Marker works just fine Question: Anyone know How to indicate to MapKit Map view to draw the content? Or how to have a slight "break" between animation keyframes, so map can catch up.
2
0
74
Jul ’25
MKLocalSearch not returning Places in the specified region
Hi- I've never posted on here before! But ChatGPT hasn't been helpful with this. I have a call using MKLocalSearch (i have a waddled down version below) let region = MKCoordinateRegion( center: location, // the user's location span: MKCoordinateSpan( latitudeDelta: 0.005, longitudeDelta: 0.005 ) ) let req = MKLocalPointsOfInterestRequest(coordinateRegion: region) req.pointOfInterestFilter = MKPointOfInterestFilter(including: [.nightlife]) let search = MKLocalSearch(request: req) I made the latitude and longitude the lowest they can possibly be without throwing an error. Sometimes (and unreliably) when the user's location is at say, a bar, this list will give me like 10 bars that are not even within the region, and exclude the bar that the user is actually present in. How can i make this not the case? In other words, I just want this to return what I expect: a list of POIs with the category .nightLife within the defined region. Any help would be appreciated!
0
0
146
Jul ’25
Observation feedback loop on simple Map() view declaration
Project minimum iOS deployment is set to 16.4. When running this simple code in console we receive "Observation tracking feedback loop detected!" and map is unusable. Run code: Map(coordinateRegion: .constant(.init())) Console report: ... Observable object key path '\_UICornerProvider.<computed 0x00000001a2768bc0 (Optional<UICoordinateSpace>)>' changed; performing invalidation for [layout] of: <_TtGC7SwiftUI21UIKitPlatformViewHostGVS_P10$1a57c8f9c32PlatformViewRepresentableAdaptorGV15_MapKit_SwiftUI8_MapViewGSaVS2_P10$24ce3fc8014AnnotationData____: 0x10acc2d00; baseClass = _TtGC5UIKit22UICorePlatformViewHostGV7SwiftUIP10$1a57c8f9c32PlatformViewRepresentableAdaptorGV15_MapKit_SwiftUI8_MapViewGSaVS3_P10$24ce3fc8014AnnotationData____; frame = (0 0; 353 595); anchorPoint = (0, 0); tintColor = UIExtendedSRGBColorSpace 0.333333 0.333333 0.333333 1; layer = <CALayer: 0x12443a430>> Observable object key path '\_UICornerProvider.<computed 0x00000001a2768bc0 (Optional<UICoordinateSpace>)>' changed; performing invalidation for [layout] of: <_MapKit_SwiftUI._SwiftUIMKMapView: 0x10ae8ce00; frame = (0 0; 353 595); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x113beb7e0>> Observable object key path '\_UICornerProvider.<computed 0x00000001a2768bc0 (Optional<UICoordinateSpace>)>' changed; performing invalidation for [layout] of: <_MapKit_SwiftUI._SwiftUIMKMapView: 0x10ae8ce00; frame = (0 0; 353 595); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x113beb7e0>> Observable object key path '\_UICornerProvider.<computed 0x00000001a2768bc0 (Optional<UICoordinateSpace>)>' changed; performing invalidation for [layout] of: <_MapKit_SwiftUI._SwiftUIMKMapView: 0x10ae8ce00; frame = (0 0; 353 595); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x113beb7e0>> Observation tracking feedback loop detected! Make a symbolic breakpoint at UIObservationTrackingFeedbackLoopDetected to catch this in the debugger. Refer to the console logs for details about recent invalidations; you can also make a symbolic breakpoint at UIObservationTrackingInvalidated to catch invalidations in the debugger. Object receiving repeated [layout] invalidations: <_TtGC7SwiftUI21UIKitPlatformViewHostGVS_P10$1a57c8f9c32PlatformViewRepresentableAdaptorGV15_MapKit_SwiftUI8_MapViewGSaVS2_P10$24ce3fc8014AnnotationData____: 0x10acc2d00; baseClass = _TtGC5UIKit22UICorePlatformViewHostGV7SwiftUIP10$1a57c8f9c32PlatformViewRepresentableAdaptorGV15_MapKit_SwiftUI8_MapViewGSaVS3_P10$24ce3fc8014AnnotationData____; frame = (0 0; 353 595); anchorPoint = (0, 0); tintColor = UIExtendedSRGBColorSpace 0.333333 0.333333 0.333333 1; layer = <CALayer: 0x12443a430>> Observation tracking feedback loop detected! Make a symbolic breakpoint at UIObservationTrackingFeedbackLoopDetected to catch this in the debugger. Refer to the console logs for details about recent invalidations; you can also make a symbolic breakpoint at UIObservationTrackingInvalidated to catch invalidations in the debugger. Object receiving repeated [layout] invalidations: <_MapKit_SwiftUI._SwiftUIMKMapView: 0x10ae8ce00; frame = (0 0; 353 595); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x113beb7e0>> IDE: Xcode 26 Beta 3 Testing device: iPhone 15 Pro iOS 26 Beta 3 MacOS: Tahoe 26 Beta 3
2
3
138
Jul ’25
Disable Hit Testing on SwiftUI Map Annotation Content
Hi, I’m using SwiftUI’s Map with custom Annotation content and trying to make the annotation view ignore touch interactions—similar to applying .allowsHitTesting(false) on regular views. The goal is to ensure that map gestures such as long press and drag are not blocked by annotation content. However, setting .allowsHitTesting(false) on the annotation content doesn’t seem to have any effect. Is there any workaround or supported approach to allow the map to receive gestures even when they originate from annotation views? Thanks in advance for any guidance!
0
0
72
Jul ’25
.navigationTitle and List misbehaving with a Map()
When navigated to another view with a NavigationStack or NavigationView, the .navigationTitle modifying a List or Form containing a Map() gets quirky when trying to show the title. The back button is displayed correctly, but the title does not follow the same color scheme as the List of Form, rather it is white with a divider underneath it. It's like it is confusing the .inline with the .large navigation display modes. This doesn't just show up in the simulator, but on actual devices too. This is a test main view... import SwiftUI struct ContentView: View { var body: some View { NavigationStack { NavigationLink(destination: MapErrorView()) { Text("Map View") } } } } This is a test navigated view... import SwiftUI import MapKit struct MapErrorView: View { var body: some View { NavigationStack { Form { Section(header: Text("Map of the US States")) { Text("Map Error") Map() .frame(height: 220) } } .navigationTitle("Map Error") .navigationBarTitleDisplayMode(.large) } } } Attached is an image showing this error occurring. Does anyone know how I can get around this without using Text() to mock it? That might be the only way to get around this error.
3
0
126
Jul ’25
Map view in UIKit does not have a soft edge effect with navigation bar on iOS 26
I have a map view that is presented as a modal in a navigation bar with a title view. The navigation bar is completely transparent in iOS 26 and the bar button items are displayed with a glassy effect. Since there is no soft edge effect, like we have on scroll views, it can be hard to read the text in the title view. Is there a way to get the soft edge effect on a map view that has a navigation bar? Not sure if I'm missing something obvious.
1
0
126
Jul ’25
Map Switcher MapKit iOS 14 and up
Hello everyone, I have just started coding using swift and I´m currently building an app that ist using MapKit. It is required to run on iOS 14 and newer and I want to add a Map switcher to switch between the Map Views Standard, Satellite, Hybrid and eventually also OSM. However this apparently is not as straight forward as it seems and I just don't get it to work. I had multiple attempts such as these two, each interface with a separate MapSwitcherView that open on the press of a button: var body: some View { ZStack(alignment: .bottomTrailing) { Group { if selectedMapStyle == .openStreetMap { openStreetMapView() } else { MapContainer(region: $locationManager.region, tracking: $tracking, style: selectedMapStyle) } } .id(selectedMapStyle) .onChange(of: selectedMapStyle) { newStyle in print("Style changed to: (newStyle)") } and Group { switch selectedMapStyle { case .standard: Map(coordinateRegion: $locationManager.region, interactionModes: .all, showsUserLocation: true, userTrackingMode: $tracking) .id("standard") case .satellite: Map(coordinateRegion: $locationManager.region, interactionModes: .all, showsUserLocation: true, userTrackingMode: $tracking) .id("satellite") case .hybrid: Map(coordinateRegion: $locationManager.region, interactionModes: .all, showsUserLocation: true, userTrackingMode: $tracking) .id("hybrid") case .openStreetMap: openStreetMapView() } } Unfortunately the map just doesn't switch. Do you have any suggestions? Should I post some more code of the MapSwitcher or something? Thanks and best regards
4
0
104
Jun ’25
SwiftUI MapKit Marker ignores tint gradient for some colors
Hi, has anyone noticed that when using SwiftUI the MapKit Marker created with Marker(item: MKMapItem) .tint(.red) //solid flat color ignores the default marker styling (the nice gradient and shadow) and shows only a flat solid fill? The shadow/gradient appears correctly with some colors like .blue or .orange, but disappears with others such as .red, .purple, etc. What’s odd is that this happens only with the init(item: MKMapItem) initializer. A marker created with, for example, following init works just fine. Marker("hello", coordinate: CLLocationCoordinate2D) .tint(.red) //nice shadow/gradient Is this a bug, or does a marker backed by an MKMapItem support only a limited color range? (If so, exposing .tint there seems inconsistent—either all colors should work or none.) Has anyone else run into this problem? .orange with shadow/gradient: .red solid without shadow/gradient:
1
0
67
Jun ’25