- Home
- Skills
- Mapbox
- Mapbox Agent Skills
- Mapbox Ios Patterns
mapbox-ios-patterns_skill
- JavaScript
10
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill mapbox/mapbox-agent-skills --skill mapbox-ios-patterns- AGENTS.md5.5 KB
- SKILL.md17.8 KB
Overview
This skill provides official integration patterns for Mapbox Maps SDK v11 on iOS, covering Swift, SwiftUI, and UIKit examples. It guides installation, access token setup, map initialization, annotations, user location, GeoJSON data, styles, camera control, and feature interactions. The content focuses on practical code patterns derived from Mapbox documentation.
How this skill works
The skill presents concise, reusable code patterns and configuration steps: add the Mapbox package or pods, set the access token, and initialize Map or MapView with camera options. It shows how to add annotations (points, circles, polylines, polygons), attach GeoJSON sources and layers, display and track user location, perform camera animations and fits, and handle feature taps using the Interactions API. Examples include both SwiftUI and UIKit idioms and show how to update or remove layers and sources.
When to use it
- Setting up Mapbox Maps SDK in a new or existing iOS app
- Adding markers, shapes, and custom GeoJSON data to a map
- Displaying and following user location with camera tracking
- Customizing map style or loading a style from Mapbox Studio
- Implementing feature taps and typed feature interactions with the Interactions API
Best practices
- Store the MBXAccessToken in Info.plist and avoid hardcoding sensitive keys
- Reuse annotation managers for frequent updates instead of recreating them
- Request and verify location permissions before enabling the user puck or camera follow
- Group GeoJSON data into sources and layers so styling and updates are centralized
- Use camera ease/fly methods for smooth transitions and camera(for:padding:) to fit multiple coordinates
Example use cases
- Show a clustered list of POI markers with custom icons and callouts
- Draw a route polyline from GeoJSON and update its color/width dynamically
- Center and follow the user with a 2D puck and update camera bearing as device moves
- Load a custom style from Mapbox Studio and switch between built-in styles
- Tap building or POI features using the Interactions API to show details and highlight selections
FAQ
Mapbox Maps SDK v11 patterns assume iOS 12+, Xcode 15+, and Swift 5.9+.
How do I add my Mapbox access token?
Add MBXAccessToken to Info.plist with your public token from your Mapbox account; do not commit private keys to source control.