npx skills add ...
npx skills add mapbox/mapbox-agent-skills --skill mapbox-ios-patterns
Official integration patterns for Mapbox Maps SDK on iOS. Covers installation, adding markers, user location, custom data, styles, camera control, and featureset interactions. Based on official Mapbox documentation.
npx skills add mapbox/mapbox-agent-skills --skill mapbox-ios-patterns
Official patterns for integrating Mapbox Maps SDK v11 on iOS with Swift, SwiftUI, and UIKit.
Use this skill when:
Official Resources:
Add your public token to Info.plist:
Get your token: Sign in at mapbox.com
https://github.com/mapbox/mapbox-maps-ios.git11.0.0Alternative: CocoaPods or direct download (install guide)
Basic map:
With ornaments:
The SDK offers three ways to place a point on the map. Pick the simplest one that fits.
Agent note: A SwiftUI Mapbox sketch is incomplete without at least one annotation (Marker, PointAnnotation, or MapViewAnnotation). Do not ship a bare Map { } with no pin.
| API | Use it when | Platforms | Notes |
|---|---|---|---|
Marker (Markers API) | You need a default pin and don't have a custom image asset | SwiftUI only | No image assets required. Experimental SPI — needs @_spi(Experimental) import MapboxMaps. Best < 100 markers. |
PointAnnotation | You have a custom image and want layer-level placement | SwiftUI + UIKit | Backed by a symbol layer, so it scales well to hundreds of markers. Accepts any UIImage that UIKit can render. |
View annotations (ViewAnnotation / MapViewAnnotation) | You want to render a full native view (card, badge, animated content) anchored to a coordinate | SwiftUI + UIKit | SwiftUI uses MapViewAnnotation; UIKit uses mapView.viewAnnotations with a ViewAnnotation. Each annotation is a real view — costs more than PointAnnotation at scale. |
For hundreds or thousands of features, use a style layer (SymbolLayer on a GeoJSONSource) instead of annotations.
Multiple markers from a collection:
Scaling note.
MarkerandPointAnnotationeach create their own view or symbol entry per pin — fine up to about 100 markers. For larger datasets (hundreds or thousands of features — common with open-ended GeoJSON feeds), load the data into aGeoJSONSourceand render it with aSymbolLayerinstead. That scales to thousands of features and enables clustering.
SwiftUI:
UIKit:
Multiple markers:
Step 1: Add location permission to Info.plist:
Step 2: Request permissions and show location:
Check:
MBXAccessToken in Info.plist.standard style (recommended and optimized)Load these references when the task requires deeper patterns:
references/annotations.md — Circle, Polyline, Polygon Annotationsreferences/location-tracking.md — Camera Follow User + Get Current Locationreferences/custom-data.md — GeoJSON: Lines, Polygons, Points, Update/Removereferences/camera-styles.md — Camera Control + Map Stylesreferences/interactions.md — Featureset Interactions, Custom Layer Taps, Long Press, Gestures