Skip to content

Latest commit

 

History

History
320 lines (309 loc) · 51.5 KB

MapKit.md

File metadata and controls

320 lines (309 loc) · 51.5 KB

MapKit

Symbols: 76.6% of Apple's iOS API (896 of 1170, exact) · Rows: 19: 16 ✅ 1 🟡 2 ❌ · iOS: 3.0+

Area: Location, personal data & sensors · Apple: MapKit · Issues: area:location

How isim implements it

  • Adapted: an offline basemap drawn from Natural Earth polygons (Land.swift, Basemap.swift), search from the gazetteer, and directions from an OSRM server you run.

API

API / feature Status iOS Notes
MapKit MKMapView (region, camera, map types, gestures, conversion) ✅ ≤17 adapted offline basemap: water and land (coastlines from Natural Earth's public-domain land polygons, 1:50m / 1:10m, in the SDK), a lat/lon graticule and a built-in list of world cities/landmarks (a label that would collide with an annotation view or its title is left out, as Apple Maps does; the map's dump text lists the labels drawn, tested by test_personal_objc); no roads or buildings (isim has no map data service) unless raster tiles come from a local cache (ISIM_MAP_TILES or $ISIM_DATA/Library/Maps/Tiles/{z}/{x}/{y}.png, never downloaded). Heading (the map turned, compass shown while turned; a tap turns back to north) and pitch (perspective tilt up to 60°; adapted: iOS's limit varies with zoom), pan, pinch, two-finger rotate and tilt, double-tap zoom; animated region/camera changes (0.35 s, visible-region updates per frame); zoom range/boundary honoured; showsCompass, showsScale, showsUserTrackingButton. Tested (HelloMaps: test_mapkit, test_map_camera)
MapKit annotations (MKAnnotation, MKPointAnnotation, MKMarkerAnnotationView, MKAnnotationView, user location, selection, callouts) 🟡 ≤17 iOS-style balloon markers (tint, glyph text/image, title, bigger when selected), image views, reuse/registration, callouts with accessory controls, didSelect/didDeselect, blue user-location dot from the simulated Core Location. MKAnnotation/delegates are Swift protocols (title defaults to nil). Clustering and dragging: the row below. Tested
Clustering and dragging: MKClusterAnnotation (init(memberAnnotations:), memberAnnotations, title, subtitle), MKAnnotationView.clusteringIdentifier, cluster, isDraggable, dragState, setDragState(_:animated:), MKAnnotationView.DragState, MKMapViewDelegate mapView(_:clusterAnnotationForMemberAnnotations:) and mapView(_:annotationView:didChange:fromOldState:), MKMapViewDefaultClusterAnnotationViewReuseIdentifier ✅ ≤17 adapted (issue #417): annotation views that share a clustering identifier and overlap the frame of the group's first view (the highest displayPriority) show as one cluster annotation, regrouped as the map moves or zooms; the selected and the dragged annotation stay apart. The cluster comes from the delegate (else a plain MKClusterAnnotation) and stands at the middle of its members; a nil title becomes the first member's title and a nil subtitle "+N more"; its view comes from viewFor, the registered default cluster view or a marker with the member count as its glyph; members' cluster is that view. Cluster annotations are not in annotations. A long press on a draggable view (longdrag in scripts) lifts it 12 points and it follows the finger; the drop sets the coordinate of an MKPointAnnotation or an Objective-C annotation's setCoordinate: (a Swift class of the app's own is not moved: isim's coordinate type is not @objc), then the default setDragState goes starting → dragging and ending (or canceling) → none, each change told to the delegate. Collision hiding by displayPriority and collisionMode outside clusters is not done. Tested (HelloMaps -cluster: test_map_clustering_dragging; HelloPersonalObjC)
MapKit overlays (MKPolyline, MKPolygon, MKCircle, renderers, MKTileOverlay) ✅ ≤17 renderers draw through draw(_:zoomScale:in:) in renderer coordinates as on iOS (adapted: one call for the visible part, not per tile), so subclasses can draw themselves; path renderers: createPath, fill/stroke properties and paths overridable, line join/cap/miter, lineDashPattern/lineDashPhase, interiorPolygons cut out, strokeStart/strokeEnd; MKGradientPolylineRenderer colours along the line; geodesic polylines; tile overlays (file URLs; others through URLSession). Tested (test_mapkit, test_map_overlay_renderers)
MapKit search, directions, Look Around, snapshots ✅ ≤17 adapted, offline: MKLocalSearch/MKLocalSearchCompleter answer from Core Location's gazetteer + the basemap's cities (else placemarkNotFound); MKDirections routes and ETAs come from an OSRM server you run (ISIM_ROUTING_URL; without it directionsNotFound, isim never picks a server); Look Around scenes come from equirectangular panoramas you supply (ISIM_LOOKAROUND or $ISIM_DATA/Library/Maps/LookAround/LAT,LON.jpg; a cylindrical view turned by dragging, MKLookAroundSnapshotter), none elsewhere; MKMapSnapshotter renders the offline basemap for a region or a camera (heading; pitch not drawn). Tested (test_mapkit, test_map_services)
SwiftUI Map (Marker, Annotation, MapPolyline, MapPolygon, MapCircle, UserAnnotation, MapCameraPosition, selection, mapStyle, onMapCameraChange) ✅ ≤17 on MKMapView; Annotation content is SwiftUI in a hosted view; mapControls draws MapCompass, MapScaleView, MapUserLocationButton, MapPitchToggle on the map (adapted: standalone controls outside a map draw nothing); legacy Map(coordinateRegion:showsUserLocation:userTrackingMode:annotationItems:) with MapMarker, MapPin, MapAnnotation. Tested (test_swiftui_map, test_swiftui_map_legacy)
Objective-C interface (MapKit.framework): MKMapView (region, center, annotations, overlays, user location, tracking), MKMapViewDelegate (with dragging and clusters), MKAnnotation (the app's own classes too), MKPointAnnotation, MKClusterAnnotation, MKAnnotationViewDragState, MKUserLocation, MKPlacemark, MKAnnotationView / MKMarkerAnnotationView / MKPinAnnotationView, MKPolyline / MKPolygon / MKCircle and their renderers, MKMapItem, MKLocalSearch (request, response), MKCoordinateRegion / MKCoordinateSpan and their functions ✅ ≤17 adapted: headers over the Swift overlay's classes (Apple's Objective-C names); an Objective-C <MKAnnotation> object is wrapped for the overlay's Swift protocol and given back as itself; the struct members are Objective-C categories. Not from Objective-C yet: the camera and map configurations, directions, the search completer, snapshots. Tested (HelloPersonalObjC, tests/ui/test_personal_objc.py)
Map features: MKMapView.selectableMapFeatures, MKMapFeatureOptions, MKMapFeatureAnnotation (featureType, pointOfInterestCategory, iconStyle, title), MKMapFeatureAnnotation.FeatureType, MKIconStyle, MKMapItemRequest (init(mapFeatureAnnotation:), getMapItem, featureAnnotation, mapFeatureAnnotation, cancel(), isCancelled, isLoading) ✅ ≤17 adapted: isim's basemap has no points-of-interest service, so its own labels are the features: landmarks are points of interest (category landmark, a star icon), cities territories; no physical features. A tap on a label of a selectable kind adds and selects an MKMapFeatureAnnotation (the delegate's viewFor/didSelect see it); deselecting removes it. MKMapItemRequest finds the place in the offline gazetteer, else an item at the feature. selectableMapFeatures was an Int before 0.28 (ABI note in isim/abi/allowlist.txt). Tested (HelloMaps -features: test_map_features; HelloPersonalObjC)
MKUserTrackingBarButtonItem (init(mapView:), mapView) ✅ ≤17 adapted: a bar button that cycles the map's tracking mode (none, follow, follow with heading) and shows the mode's location symbol. Tested (HelloMaps -features: test_map_features)
SwiftUI map features: MapFeature (kind, title, coordinate, pointOfInterestCategory, backgroundColor, image), Map(…selection: Binding<MapFeature?>), MapSelection (iOS 18: Map(…selection: Binding<MapSelection<V>?>), value, feature), mapFeatureSelectionDisabled, mapFeatureSelectionContent, MKMapItemRequest(feature:) ✅ ≤17 adapted, on MKMapView's feature selection (above): a tap on a landmark or city label selects it; the selection content (a Marker or an Annotation) stands at the feature. Tested (HelloMaps -swiftui-features: test_swiftui_map_features, every iOS version)
MapReader, MapProxy (convert(_:from:), convert(_:to:), camera(framing:)) ✅ ≤17 adapted: the proxy converts through the MKMapView of the Map inside the reader (local or global coordinate spaces); camera(framing:) fits a region in the map's size. Tested (HelloMaps -swiftui-features)
LookAroundPreview (init(initialScene:…), init(scene:…)), MKLookAroundBadgePosition ✅ ≤17 adapted: shows the scene in the Look Around viewer (scenes come from panoramas you supply, as for MKLookAroundViewController); without one, "Look Around isn't available". Road labels, points of interest and the badge are not drawn. Tested (HelloMaps -swiftui-features)
Types not yet in isim (iOS 17 and earlier) ❌ ≤17 not implemented, found by the 2026-10 sweep: AnyMapContent, DefaultUserAnnotationContent, DynamicMapContent, EmptyMapContent, MapContentView, MapSelectable, MapSelectableContentView, TupleMapContent (8 types; with their members under "Not yet in isim")
Types not yet in isim (iOS 18) ❌ 18.0 not implemented, found by the 2026-10 sweep: MapItemDetailSelectionAccessoryStyle, MKAddressFilter, MKLocalSearchRegionPriority, MKMapItemAnnotation, MKMapItemDetailViewController, MKMapItemDetailViewControllerDelegate, MKSelectionAccessory, MKSelectionAccessory.MapItemDetailPresentationStyle, MKSelectionAccessory.MapItemDetailPresentationStyle.CalloutStyle (9 types; with their members under "Not yet in isim")
Geocoding (iOS 26): MKGeocodingRequest, MKReverseGeocodingRequest (mapItems, getMapItems(completionHandler:), cancel(), isCancelled, isLoading, preferredLocale, region) ✅ 26.0 adapted, offline: answered from Core Location's gazetteer (the places CLGeocoder and MKLocalSearch know); no match is MKError.placemarkNotFound, ISIM_GEOCODER=offline gives serverFailure. Tested (HelloMaps -geocode: test_geocoding_addresses_geojson)
Addresses (iOS 26): MKAddress (fullAddress, shortAddress), MKAddressRepresentations (fullAddress(includingRegion:singleLine:), cityName, cityWithContext, regionName, regionCode), MKMapItem init(location:address:), location, address, addressRepresentations ✅ 26.0 adapted: built from the place's street, city, state, postal code and country (the city's context: its state in the United States, else its country). Tested (HelloMaps -geocode: test_geocoding_addresses_geojson)
MKDistanceFormatter (string(fromDistance:), distance(from:), units, unitStyle, locale) ✅ ≤17 adapted: like Maps, metric (m below 1 km, km with one decimal below 10) or imperial (ft below 0.1 mi, or yd; mi with one decimal below 10); the locale's measurement system by default; abbreviated or full unit names. Tested (HelloMaps -geocode)
MKGeoJSONDecoder, MKGeoJSONFeature (identifier, properties, geometry), MKGeoJSONObject ✅ ≤17 passthrough of the format (RFC 7946): Point → MKPointAnnotation, MultiPoint → MKMultiPoint, LineString → MKPolyline, MultiLineString → MKMultiPolyline, Polygon → MKPolygon (holes as interior polygons), MultiPolygon → MKMultiPolygon, GeometryCollection; malformed input throws MKError.decodingFailed. Tested (HelloMaps -geocode: shapes drawn on the map)
Launch options: MKLaunchOptionsDirectionsModeKey and the other keys, MKLaunchOptionsDirectionsModeDriving / Walking / Transit / Cycling / Default ✅ ≤17 the constants; openInMaps logs and returns false (isim has no Maps app). Tested (HelloMaps -geocode)

Not yet in isim

274 symbols Apple documents for iOS that isim does not have (exact; Apple snapshot 2026-10-14). Each links to Apple's documentation.

List