capacitor-plugin-apple-maps
v0.5.0
Published
Capacitor plugin rendering native Apple Maps (MapKit) on iOS, API-compatible with @capacitor/google-maps.
Readme
capacitor-plugin-apple-maps
Renders a native Apple Maps (MapKit) view on iOS from a Capacitor app. The
AppleMap wrapper class deliberately mirrors the core subset of
@capacitor/google-maps'
GoogleMap API - create, camera, markers, clustering, and camera-idle /
marker-click events - so an app can route iOS to Apple Maps and Android/web to
Google Maps behind one thin abstraction.
- iOS only. MapKit is a native iOS framework and needs no API key. On web
and Android every method rejects with
unavailable- the host app is expected to use another provider on those platforms. - No external dependencies. Uses the system
MapKitframework; the only SPM dependency iscapacitor-swift-pm. - Requires iOS 15+ (matches the Capacitor 8 baseline).
Install
npm install capacitor-plugin-apple-maps
npx cap sync iosUsage
Bind the map to a <capacitor-apple-map> element (registered automatically when
you import the wrapper):
<capacitor-apple-map id="map" style="position:absolute; inset:0"></capacitor-apple-map>import { AppleMap } from 'capacitor-plugin-apple-maps';
const map = await AppleMap.create({
id: 'map',
element: document.getElementById('map')!,
config: {
center: { lat: 42.36, lng: -71.06 },
zoom: 11,
minZoom: 7,
},
});
await map.setOnMarkerClickListener((data) => console.log('tapped', data.markerId));
await map.setOnCameraIdleListener((data) => console.log('idle at', data.zoom, data.bounds));
const ids = await map.addMarkers([
{ coordinate: { lat: 42.36, lng: -71.06 }, iconUrl: 'marker-blue.png', iconSize: { width: 30, height: 36 } },
]);
await map.enableClustering();A marker with no iconUrl draws MapKit's native pin
(MKMarkerAnnotationView), the same way @capacitor/google-maps falls back to a
default marker - so a marker written against the shared API is always visible.
Supply an iconUrl to use your own art, resolved from three sources: a bundled
web asset filename (copied into the app bundle under public/ - e.g.
marker-blue.png from your web static/), an https: URL, or a data:
URI. SVG is not supported.
Sharing one abstraction with @capacitor/google-maps
The wrapper's method names and payload shapes (LatLng, LatLngBounds,
CameraIdleCallbackData, MarkerClickCallbackData) match @capacitor/google-maps,
so a host app can pick the provider per platform:
const map =
Capacitor.getPlatform() === 'ios'
? await AppleMap.create({ id, element, config })
: await GoogleMap.create({ id, element, apiKey, config });Notes & limitations
- Zoom is approximated. MapKit uses region spans, not Google's integer zoom; the plugin converts using the web-mercator tile relationship. Reported zoom round-trips but is not pixel-identical to Google.
- Cluster taps zoom to fit the cluster members (Apple-native behaviour) rather than firing an event.
minZoomis enforced on programmatic moves and by bouncing back a gesture that overshoots the floor.maxZoomis currently advisory.
API
create(...)destroy(...)setCamera(...)getMapBounds(...)getCameraPosition(...)fitBounds(...)addMarkers(...)addMarker(...)updateMarkers(...)removeMarkers(...)removeMarker(...)enableClustering(...)disableClustering(...)addPolylines(...)addPolygons(...)addCircles(...)removeOverlays(...)setMapType(...)enableCurrentLocation(...)setTrafficEnabled(...)setPointsOfInterestEnabled(...)setCompassEnabled(...)setScaleEnabled(...)setColorScheme(...)setGestures(...)setPadding(...)takeSnapshot(...)searchAutocomplete(...)searchPlaces(...)searchResolve(...)onResize(...)onDisplay(...)onScroll(...)addListener('onCameraIdle', ...)addListener('onMarkerClick', ...)addListener('onInfoWindowClick', ...)addListener('onMapReady', ...)addListener('onMapClick', ...)addListener('onMapLongClick', ...)addListener('onClusterClick', ...)addListener('onCameraMoveStarted', ...)addListener('onMarkerDragStart', ...)addListener('onMarkerDrag', ...)addListener('onMarkerDragEnd', ...)- Interfaces
- Type Aliases
Low-level bridge to the native MapKit implementation. Most callers should use the {@link AppleMap} wrapper instead of these methods directly.
create(...)
create(options: { id: string; config: AppleMapConfig; element?: unknown; forceCreate?: boolean; }) => Promise<void>| Param | Type |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| options | { id: string; config: AppleMapConfig; element?: unknown; forceCreate?: boolean; } |
destroy(...)
destroy(options: { id: string; }) => Promise<void>| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
setCamera(...)
setCamera(options: { id: string; config: CameraConfig; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------------------------ |
| options | { id: string; config: CameraConfig; } |
getMapBounds(...)
getMapBounds(options: { id: string; }) => Promise<LatLngBounds>| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
Returns: Promise<LatLngBounds>
getCameraPosition(...)
getCameraPosition(options: { id: string; }) => Promise<CameraPosition>Current camera as { latitude, longitude, zoom, bounds }.
| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
Returns: Promise<CameraPosition>
fitBounds(...)
fitBounds(options: { id: string; bounds: LatLngBounds; padding?: number; animate?: boolean; }) => Promise<void>Move the camera to fit bounds, insetting the visible rect by padding
points on every side (default 0). Animates unless animate is false.
| Param | Type |
| ------------- | ------------------------------------------------------------------------------------------------------------------- |
| options | { id: string; bounds: LatLngBounds; padding?: number; animate?: boolean; } |
addMarkers(...)
addMarkers(options: { id: string; markers: Marker[]; }) => Promise<{ ids: string[]; }>| Param | Type |
| ------------- | ----------------------------------------------- |
| options | { id: string; markers: Marker[]; } |
Returns: Promise<{ ids: string[]; }>
addMarker(...)
addMarker(options: { id: string; marker: Marker; }) => Promise<{ id: string; }>Add a single marker, returning its id. Convenience over {@link addMarkers}.
| Param | Type |
| ------------- | ------------------------------------------------------------------ |
| options | { id: string; marker: Marker; } |
Returns: Promise<{ id: string; }>
updateMarkers(...)
updateMarkers(options: { id: string; markers: MarkerUpdate[]; }) => Promise<void>Apply partial changes to existing markers, addressed by markerId.
| Param | Type |
| ------------- | ----------------------------------------------------- |
| options | { id: string; markers: MarkerUpdate[]; } |
removeMarkers(...)
removeMarkers(options: { id: string; markerIds: string[]; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------- |
| options | { id: string; markerIds: string[]; } |
removeMarker(...)
removeMarker(options: { id: string; markerId: string; }) => Promise<void>Remove a single marker by id. Convenience over {@link removeMarkers}.
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; markerId: string; } |
enableClustering(...)
enableClustering(options: { id: string; }) => Promise<void>| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
disableClustering(...)
disableClustering(options: { id: string; }) => Promise<void>| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
addPolylines(...)
addPolylines(options: { id: string; polylines: Polyline[]; }) => Promise<{ ids: string[]; }>| Param | Type |
| ------------- | --------------------------------------------------- |
| options | { id: string; polylines: Polyline[]; } |
Returns: Promise<{ ids: string[]; }>
addPolygons(...)
addPolygons(options: { id: string; polygons: Polygon[]; }) => Promise<{ ids: string[]; }>| Param | Type |
| ------------- | ------------------------------------------------- |
| options | { id: string; polygons: Polygon[]; } |
Returns: Promise<{ ids: string[]; }>
addCircles(...)
addCircles(options: { id: string; circles: Circle[]; }) => Promise<{ ids: string[]; }>| Param | Type |
| ------------- | ----------------------------------------------- |
| options | { id: string; circles: Circle[]; } |
Returns: Promise<{ ids: string[]; }>
removeOverlays(...)
removeOverlays(options: { id: string; ids: string[]; }) => Promise<void>Remove overlays (polylines, polygons, or circles) by the ids their add call returned.
| Param | Type |
| ------------- | ------------------------------------------- |
| options | { id: string; ids: string[]; } |
setMapType(...)
setMapType(options: { id: string; mapType: MapType; }) => Promise<void>Set the base map imagery.
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options | { id: string; mapType: MapType; } |
enableCurrentLocation(...)
enableCurrentLocation(options: { id: string; enabled: boolean; }) => Promise<void>Show or hide the blue user-location dot. The host app is responsible for the
NSLocationWhenInUseUsageDescription Info.plist key and for prompting the
user for location permission; without it MapKit shows nothing.
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; enabled: boolean; } |
setTrafficEnabled(...)
setTrafficEnabled(options: { id: string; enabled: boolean; }) => Promise<void>Overlay or hide live traffic conditions (MKMapView.showsTraffic).
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; enabled: boolean; } |
setPointsOfInterestEnabled(...)
setPointsOfInterestEnabled(options: { id: string; enabled: boolean; }) => Promise<void>Show or hide Apple's points of interest (a .includingAll / .excludingAll filter).
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; enabled: boolean; } |
setCompassEnabled(...)
setCompassEnabled(options: { id: string; enabled: boolean; }) => Promise<void>Show or hide the compass (MKMapView.showsCompass).
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; enabled: boolean; } |
setScaleEnabled(...)
setScaleEnabled(options: { id: string; enabled: boolean; }) => Promise<void>Show or hide the scale bar (MKMapView.showsScale).
| Param | Type |
| ------------- | ---------------------------------------------- |
| options | { id: string; enabled: boolean; } |
setColorScheme(...)
setColorScheme(options: { id: string; colorScheme: MapColorScheme; }) => Promise<void>Force a light/dark appearance, or default to follow the device setting.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------- |
| options | { id: string; colorScheme: MapColorScheme; } |
setGestures(...)
setGestures(options: { id: string; gestures: MapGestures; }) => Promise<void>Enable or disable user gestures (only the fields you pass are changed).
| Param | Type |
| ------------- | ------------------------------------------------------------------------------ |
| options | { id: string; gestures: MapGestures; } |
setPadding(...)
setPadding(options: { id: string; padding: MapPadding; }) => Promise<void>Inset the map's edges (shifts controls inward and pads fitBounds).
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | { id: string; padding: MapPadding; } |
takeSnapshot(...)
takeSnapshot(options: { id: string; }) => Promise<{ image: string; }>Render the current map view to a PNG, returned as a data: URL - the visible
base map with the marker pins and overlays composited on top.
| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
Returns: Promise<{ image: string; }>
searchAutocomplete(...)
searchAutocomplete(options: { query: string; region?: SearchRegion; }) => Promise<{ results: SearchCompletion[]; }>Type-ahead place autocomplete via MKLocalSearchCompleter. Needs no API
key. Pass region to bias suggestions toward the area in view. Each result
carries an opaque id; pass it to {@link searchResolve} to get coordinates.
| Param | Type |
| ------------- | ---------------------------------------------------------------------------------- |
| options | { query: string; region?: SearchRegion; } |
Returns: Promise<{ results: SearchCompletion[]; }>
searchPlaces(...)
searchPlaces(options: { query: string; region?: SearchRegion; maxDistanceKm?: number; limit?: number; }) => Promise<{ results: SearchResult[]; }>One-shot place search via MKLocalSearch. Unlike {@link searchAutocomplete}
the results carry coordinates up front. Pass region to scope/bias results,
maxDistanceKm to drop results farther than that from the region center
(e.g. a US ZIP that also exists abroad), and limit to cap the count.
| Param | Type |
| ------------- | -------------------------------------------------------------------------------------------------------------------------- |
| options | { query: string; region?: SearchRegion; maxDistanceKm?: number; limit?: number; } |
Returns: Promise<{ results: SearchResult[]; }>
searchResolve(...)
searchResolve(options: { id: string; }) => Promise<{ lat?: number; lng?: number; title?: string; }>Resolve a suggestion id (from either search method) to coordinates.
Returns an empty object if the id is unknown or has no location.
| Param | Type |
| ------------- | ---------------------------- |
| options | { id: string; } |
Returns: Promise<{ lat?: number; lng?: number; title?: string; }>
onResize(...)
onResize(options: { id: string; mapBounds: MapBounds; }) => Promise<void>Keep the native frame in sync as the element resizes.
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | { id: string; mapBounds: MapBounds; } |
onDisplay(...)
onDisplay(options: { id: string; mapBounds: MapBounds; }) => Promise<void>Re-mount the native view after the element becomes visible again.
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | { id: string; mapBounds: MapBounds; } |
onScroll(...)
onScroll(options: { id: string; mapBounds: MapBounds; }) => Promise<void>Keep the native frame in sync as the page scrolls (no-op on iOS).
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | { id: string; mapBounds: MapBounds; } |
addListener('onCameraIdle', ...)
addListener(eventName: 'onCameraIdle', listenerFunc: (data: CameraIdleCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------- |
| eventName | 'onCameraIdle' |
| listenerFunc | (data: CameraIdleCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMarkerClick', ...)
addListener(eventName: 'onMarkerClick', listenerFunc: (data: MarkerClickCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | 'onMarkerClick' |
| listenerFunc | (data: MarkerClickCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onInfoWindowClick', ...)
addListener(eventName: 'onInfoWindowClick', listenerFunc: (data: MarkerClickCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | 'onInfoWindowClick' |
| listenerFunc | (data: MarkerClickCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMapReady', ...)
addListener(eventName: 'onMapReady', listenerFunc: (data: MapReadyCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | 'onMapReady' |
| listenerFunc | (data: MapReadyCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMapClick', ...)
addListener(eventName: 'onMapClick', listenerFunc: (data: MapClickCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | 'onMapClick' |
| listenerFunc | (data: MapClickCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMapLongClick', ...)
addListener(eventName: 'onMapLongClick', listenerFunc: (data: MapLongClickCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | 'onMapLongClick' |
| listenerFunc | (data: MapClickCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onClusterClick', ...)
addListener(eventName: 'onClusterClick', listenerFunc: (data: ClusterClickCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------ |
| eventName | 'onClusterClick' |
| listenerFunc | (data: ClusterClickCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onCameraMoveStarted', ...)
addListener(eventName: 'onCameraMoveStarted', listenerFunc: (data: CameraMoveStartedCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | 'onCameraMoveStarted' |
| listenerFunc | (data: CameraMoveStartedCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMarkerDragStart', ...)
addListener(eventName: 'onMarkerDragStart', listenerFunc: (data: MarkerDragCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------- |
| eventName | 'onMarkerDragStart' |
| listenerFunc | (data: MarkerDragCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMarkerDrag', ...)
addListener(eventName: 'onMarkerDrag', listenerFunc: (data: MarkerDragCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------- |
| eventName | 'onMarkerDrag' |
| listenerFunc | (data: MarkerDragCallbackData) => void |
Returns: Promise<PluginListenerHandle>
addListener('onMarkerDragEnd', ...)
addListener(eventName: 'onMarkerDragEnd', listenerFunc: (data: MarkerDragCallbackData) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------- |
| eventName | 'onMarkerDragEnd' |
| listenerFunc | (data: MarkerDragCallbackData) => void |
Returns: Promise<PluginListenerHandle>
Interfaces
AppleMapConfig
Initial map configuration. The width/height/x/y/devicePixelRatio
fields are populated by the {@link AppleMap} wrapper from the bound element's
bounding rectangle - callers do not set them.
| Prop | Type | Description |
| --------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| center | LatLng | |
| zoom | number | Google-style zoom (0 = whole world). Converted to an MKCoordinateRegion span natively. |
| minZoom | number | Hard zoom-out floor. Programmatic and gesture moves are clamped to this. |
| maxZoom | number | |
| clustering | boolean | Start with clustering enabled, so markers added later cluster on their first render instead of briefly appearing as individual pins. Equivalent to calling {@link AppleMap.enableClustering} before any {@link AppleMap.addMarkers}, but without the flash. Defaults to false. |
| mapType | MapType | Base map imagery. Defaults to standard. |
| showInfoWindows | boolean | Show an info-window bubble (title + optional snippet) above a marker when it is tapped, closing when another marker or the map is tapped. Defaults to false, which preserves the tap-only behavior (onMarkerClick fires and no bubble appears). The bubble is drawn by the plugin rather than using MapKit's native callout, which does not render when the map is composited into the web view. |
| showsTraffic | boolean | Overlay live traffic conditions (MKMapView.showsTraffic). Defaults to false. |
| showsPointsOfInterest | boolean | Show Apple's points of interest (shops, parks, …). Maps to a MKPointOfInterestFilter of .includingAll / .excludingAll. Defaults to true (MapKit's default). |
| showsCompass | boolean | Show the compass when the map is rotated (MKMapView.showsCompass). Defaults to true. |
| showsScale | boolean | Show the scale bar while zooming (MKMapView.showsScale). Defaults to false. |
| colorScheme | MapColorScheme | Force a light/dark appearance regardless of the device setting. Defaults to default (follow system). |
| gestures | MapGestures | Which user gestures are enabled. Each defaults to true. |
| padding | MapPadding | Inset applied to the map's edges (controls + fitBounds framing). |
| width | number | |
| height | number | |
| x | number | |
| y | number | |
| devicePixelRatio | number | |
LatLng
A geographic coordinate. Field names match @capacitor/google-maps so the
two plugins can sit behind one abstraction in the host app.
| Prop | Type |
| --------- | ------------------- |
| lat | number |
| lng | number |
MapGestures
Which user gestures the map responds to. Omitted fields are left unchanged.
All default to true.
| Prop | Type | Description |
| ------------ | -------------------- | ---------------------------------------- |
| scroll | boolean | Pan/scroll the map. |
| zoom | boolean | Pinch/double-tap to zoom. |
| rotate | boolean | Two-finger rotate. |
| pitch | boolean | Two-finger drag to tilt into 3D (pitch). |
MapPadding
Inset, in points, applied to the map's edges - it shifts MapKit's controls
(compass, scale, legal link) inward and pads the frame used by fitBounds.
Omitted sides default to 0.
| Prop | Type |
| ------------ | ------------------- |
| top | number |
| left | number |
| right | number |
| bottom | number |
CameraConfig
| Prop | Type | Description |
| ---------------- | ----------------------------------------- | ---------------------------------------------------------------------------------- |
| coordinate | LatLng | |
| zoom | number | |
| animate | boolean | Animate the camera move. Defaults to false to match the host app's expectations. |
LatLngBounds
Visible-region bounds, mirroring the @capacitor/google-maps shape.
| Prop | Type |
| --------------- | ----------------------------------------- |
| southwest | LatLng |
| center | LatLng |
| northeast | LatLng |
CameraPosition
The map's current camera, returned by {@link CapacitorAppleMapsPlugin.getCameraPosition}.
| Prop | Type | Description |
| --------------- | ----------------------------------------------------- | ------------------------------------------------------- |
| latitude | number | |
| longitude | number | |
| zoom | number | Google-style zoom derived from the current region span. |
| bounds | LatLngBounds | |
Marker
| Prop | Type | Description |
| ---------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| coordinate | LatLng | |
| title | string | |
| snippet | string | Secondary line shown under title in the info-window bubble (see showInfoWindows). |
| iconUrl | string | Bundled asset filename (e.g. marker-blue.png, resolved from public/), an https: URL, or a data: URI. SVG is not supported by MapKit. Omit it to get MapKit's native default pin. |
| iconSize | { width: number; height: number; } | Logical size in points. |
| markerId | string | Caller-supplied stable id. When set it is used verbatim (and echoed back from {@link CapacitorAppleMapsPlugin.addMarkers} and on tap) instead of a generated one, so the host can map pins back to its own domain objects and target them with {@link CapacitorAppleMapsPlugin.updateMarkers}. |
| draggable | boolean | Let the user drag this pin (press-and-hold, then move). Fires onMarkerDragStart / onMarkerDrag / onMarkerDragEnd. Defaults to false. A pin that is currently clustered can't be dragged until it separates into its own annotation. |
MarkerUpdate
A partial change to an existing marker, addressed by its markerId. Omitted
fields are left as-is; a moved marker animates to its new coordinate.
| Prop | Type | Description |
| ---------------- | ----------------------------------------------- | ------------------------------------------- |
| markerId | string | |
| coordinate | LatLng | |
| title | string | |
| snippet | string | |
| iconUrl | string | |
| iconSize | { width: number; height: number; } | |
| draggable | boolean | Enable or disable dragging for this marker. |
Polyline
Shared stroke/fill styling for overlays. Colors are #RRGGBB or #RRGGBBAA hex.
| Prop | Type | Description |
| ------------------- | --------------------- | ------------------------------------------------------------------ |
| path | LatLng[] | |
| strokeColor | string | Line color hex. Defaults to the system blue. |
| strokeWeight | number | Line width in points. Defaults to 3. |
| strokeOpacity | number | Line opacity 0..1, applied on top of any alpha in strokeColor. |
Polygon
| Prop | Type | Description |
| ------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| paths | LatLng[] | LatLng[][] | Either a single ring of points, or an array of rings where the first is the exterior and the rest are holes. |
| strokeColor | string | |
| strokeWeight | number | |
| strokeOpacity | number | |
| fillColor | string | Fill color hex. Unfilled if omitted. |
| fillOpacity | number | |
Circle
| Prop | Type | Description |
| ------------------- | ----------------------------------------- | ----------------- |
| center | LatLng | |
| radius | number | Radius in meters. |
| strokeColor | string | |
| strokeWeight | number | |
| strokeOpacity | number | |
| fillColor | string | |
| fillOpacity | number | |
SearchCompletion
One type-ahead suggestion from searchAutocomplete.
| Prop | Type | Description |
| -------------- | ------------------- | -------------------------------------------------- |
| id | string | Opaque id to pass to searchResolve. |
| title | string | Primary line, e.g. a street address or place name. |
| subtitle | string | Secondary line, e.g. the city/region. |
SearchRegion
Region to bias autocomplete toward - pass the map's current center so results favour the area in view. Deltas default to 1° if omitted.
| Prop | Type |
| -------------------- | ------------------- |
| latitude | number |
| longitude | number |
| latitudeDelta | number |
| longitudeDelta | number |
SearchResult
One coordinate-bearing result from searchPlaces.
| Prop | Type | Description |
| --------------- | ------------------- | ----------------------------------------------------------------------- |
| id | string | Opaque id to pass to searchResolve (or use the coordinates directly). |
| title | string | |
| subtitle | string | |
| latitude | number | |
| longitude | number | |
MapBounds
The rectangle the native map should occupy, in CSS pixels.
| Prop | Type |
| ------------ | ------------------- |
| x | number |
| y | number |
| width | number |
| height | number |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
CameraIdleCallbackData
| Prop | Type |
| --------------- | ----------------------------------------------------- |
| mapId | string |
| latitude | number |
| longitude | number |
| zoom | number |
| bounds | LatLngBounds |
MarkerClickCallbackData
| Prop | Type |
| --------------- | ------------------- |
| mapId | string |
| markerId | string |
| latitude | number |
| longitude | number |
| title | string |
MapReadyCallbackData
| Prop | Type |
| ----------- | ------------------- |
| mapId | string |
MapClickCallbackData
| Prop | Type |
| --------------- | ------------------- |
| mapId | string |
| latitude | number |
| longitude | number |
ClusterClickCallbackData
A tap on a cluster bubble. Carries the members it groups.
| Prop | Type | Description |
| --------------- | --------------------- | ----------------------------------------- |
| mapId | string | |
| latitude | number | |
| longitude | number | |
| count | number | Number of markers in the cluster. |
| markerIds | string[] | The markerIds of the clustered markers. |
CameraMoveStartedCallbackData
Fired once when the camera begins moving, before onCameraIdle. isGesture
distinguishes a user pan/zoom/rotate from a programmatic move (a
{@link CapacitorAppleMapsPlugin.setCamera} / {@link CapacitorAppleMapsPlugin.fitBounds}
call). Mirrors @capacitor/google-maps's onCameraMoveStarted.
| Prop | Type | Description |
| --------------- | -------------------- | ------------------------------------------------------------------ |
| mapId | string | |
| isGesture | boolean | true for a user gesture, false for a programmatic camera move. |
MarkerDragCallbackData
A drag on a draggable marker, carrying the marker's live coordinate.
onMarkerDragStart fires once when the drag begins, onMarkerDrag fires
continuously as it moves, and onMarkerDragEnd fires once on release.
| Prop | Type |
| --------------- | ------------------- |
| mapId | string |
| markerId | string |
| latitude | number |
| longitude | number |
Type Aliases
MapType
Base map imagery. Maps to MKMapType; the *Flyover variants render 3D
satellite imagery where Apple has it. Defaults to standard.
'standard' | 'satellite' | 'hybrid' | 'satelliteFlyover' | 'hybridFlyover' | 'mutedStandard'
MapColorScheme
Forces the map's light/dark appearance regardless of the device setting, via
overrideUserInterfaceStyle. default follows the system.
'default' | 'light' | 'dark'
MapLongClickCallbackData
A long-press on the map surface (not on a marker).
MapClickCallbackData
Maintainers
| Maintainer | GitHub | Active | | ------------- | ----------------------------------------- | ------ | | pjaudiomv | pjaudiomv | yes |
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind are welcome!
