/mapbox:mapbox-ios-swiftui-migrationfrom mapbox
Migrates iOS Mapbox map and navigation screens from UIKit (UIViewController, storyboards, UIViewRepresentable) to SwiftUI. Covers Mapbox-specific parts like Map view, Viewport, styles, annotations, MapReader, events, and Navigation SDK v3 hosting.
Ships in mapbox. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Moves iOS map and navigation screens built with UIKit to SwiftUI. The agent does the work. The developer makes the decisions.
This skill covers only what's specific to Mapbox: the map, its content, its camera and its events. The rest of the screen (layout, navigation stack, view models, theming) is the app team's normal SwiftUI work. Say so in the plan rather than guessing at the app's architecture.
Reference files:
references/maps.md: UIKit → SwiftUI mappings for Maps SDK v11 (map view, style, camera and viewport, events, gestures, interactions, annotations, location, ornaments)references/navigation.md: Navigation SDK v3 screens in SwiftUI (hosting NavigationMapView and NavigationViewController, Combine publishers to SwiftUI state, what the SwiftUI Map can't do)references/migration-workflow.md: templates for the inventory, plan, decision log and summaryLoad maps.md for every migration. Also load navigation.md when the screen uses the Navigation SDK.
UIViewController, a storyboard, or a UIViewRepresentable wrapper inside SwiftUI, and the developer wants that screen on the SwiftUI MapNot covered:
mapbox-ios-maps-v10-to-v11-migration or mapbox-ios-navigation-v2-to-v3-migration. Never combine an SDK version migration and a SwiftUI migration in one change.mapbox-android-compose-migration if it's installed.These rules apply to every step.
Map is part of MapboxMaps. There's no separate package to add.references/maps.md needs a newer one (for example TapInteraction as map content, stable since 11.12), use the row's fallback, or propose a Maps bump as a separate change. Don't bump the SDK silently as part of this migration.Some SwiftUI-facing APIs still need @_spi(Experimental) import MapboxMaps (for example Marker, draggable MapViewAnnotation, viewAnnotationAvoidLayers). references/maps.md marks them. Don't introduce one to replace stable UIKit code without asking. If the app already imports @_spi(Experimental), keep using what it uses, and list it in the report.
Moving to SwiftUI can change what the user sees even when the code compiles. Examples: a single PointAnnotation per marker puts each marker on its own layer, the map is recreated when the view's identity changes, and the camera returns to initialViewport when the screen is rebuilt. references/maps.md has a Behavior changes table. For every row that applies:
references/migration-workflow.md).Carry the screen's style over exactly: the same style URI or JSON, the same Standard config (light preset, labels), the same runtime sources and layers with the same IDs. A UIKit screen that never set a style loaded Standard, and so does Map, so leave it. Don't move a screen to Standard or change tilesets as part of the migration.
MapReader where it doesn'tUse the SwiftUI API when references/maps.md lists one: Map modifiers, Viewport, map content (sources, layers, annotations, Puck2D, TapInteraction), event modifiers. Use MapReader and MapProxy only for what has no SwiftUI API (queries, snapshots, custom layers, annotation manager features the groups don't expose). Don't move a whole viewDidLoad into one .onAppear { proxy.map ... } and call it migrated.
MapReader rules:
proxy.map, proxy.camera, proxy.location and proxy.viewport are optional. They're nil until the map exists.proxy.map when they can be map content. Layers added through the proxy aren't part of the declaration and are lost on style reload.proxy.camera and a Viewport binding on one screenOnly use symbols from the references, the official SwiftUI user guide, the SwiftUI examples, or the SDK source and docs for the app's version. If you're unsure whether a symbol exists or has the stated signature, don't invent one. Write the closest match, add // [VERIFY WITH MAPBOX] at the call site, and list it in the report.
Migrate one map screen per change. A UIKit app hosting SwiftUI map screens through UIHostingController, or a SwiftUI app keeping a UIKit MapView in a UIViewRepresentable, is a valid end state. Don't migrate screens the developer didn't pick.
Run the workflow below when you have the project and the developer asks you to migrate or plan. When the developer describes a screen or pastes code in chat, answer directly instead of filling in the templates:
Map call, its content and modifiers, and any hosted UIKit views), with // ... for bodies that don't change, then short bullets for the rules behind it. Don't restate code the developer already has.Run the five steps in order. Don't edit code before step 2 is done and shown to the developer.
For each map screen, record:
MapView(frame:mapInitOptions:) in a view controller, a storyboard or XIB with a MapView custom class, or a UIViewRepresentable wrapping MapView) and its host (UIViewController, UIHostingController, a SwiftUI view)references/maps.md (and references/navigation.md for navigation screens)Cancelables / AnyCancellables: these show what has to move into modifiers or the view model@_spi(Experimental) imports already in the appMapKit in SwiftUI files (Map is ambiguous then; see references/maps.md)Check the Maps (and Navigation) SDK version against Rule 1.
If the app can run in the simulator or on a device, offer to take before screenshots of the map screens now. Note the device, camera position and app state so the after screenshot repeats them. Xcode Previews don't render a live map reliably, so simulator or device screenshots are the visual check for the map itself.
Suggest the order. Start with the simplest screen (one map, few annotations, no navigation) to establish the pattern. For each screen, list per area: the call sites, the SwiftUI target, effort (S < 1h, M = half a day, L = 1-2 days, XL = more, or blocked), and blockers. List every row from the Behavior changes table that applies as a decision. Use the plan template in references/migration-workflow.md.
Every plan also states:
The plan on its own answers "how much work is this?". If that was the question, stop here.
Map call: initial camera (initialViewport, or a @State Viewport if other UI moves the camera), .mapStyle(...) with the screen's style, ornament and gesture options. Follow references/maps.md..onMapLoaded, .onCameraChanged), map content handlers (TapInteraction, .onTapGesture), or the screen's view model. Delete the Cancelable bookkeeping that SwiftUI now owns.references/navigation.mdUIHostingController from the existing UIKit flow)xcodebuild with the app's scheme, or Xcode) and fix errors before moving to the next screen[VERIFY WITH MAPBOX] tag is listed, and every experimental API introduced is listedIf you can't run the app, say so in the report. Don't claim it was checked.
Write the summary from references/migration-workflow.md: screens migrated and remaining, decisions taken, [VERIFY WITH MAPBOX] items, experimental APIs introduced, and pre-existing issues seen but not fixed (for example a style reload to switch themes, or a camera move on every location update). If an audit skill is installed (for example mapbox-mobile-sdk-audit), recommend running it on the migrated screens.
| UIKit | SwiftUI |
|---|---|
MapView(frame:mapInitOptions:) in a view controller | Map(initialViewport:) { ... } or Map(viewport: $viewport) { ... } |
UIViewRepresentable wrapping MapView | Map (remove the wrapper) |
MapInitOptions(styleURI:) / mapboxMap.mapStyle = ... | .mapStyle(...) |
MapInitOptions(cameraOptions:) | initialViewport: .camera(center:zoom:bearing:pitch:) |
mapView.camera.fly(to:duration:) | withViewportAnimation(.fly) { viewport = .camera(...) } |
viewport.transition(to: viewport.makeFollowPuckViewportState()) | viewport = .followPuck(zoom:) |
mapboxMap.onMapLoaded.observeNext { } + stored Cancelable | .onMapLoaded { } |
mapboxMap.addInteraction(TapInteraction { }) | TapInteraction { } as map content |
makePointAnnotationManager() + manager.annotations = [...] | PointAnnotationGroup(items) { PointAnnotation(...) } |
annotation.tapHandler = { } | PointAnnotation(...).onTapGesture { } |
mapView.viewAnnotations.add(ViewAnnotation(coordinate:view:)) | MapViewAnnotation(coordinate:) { SwiftUIView() } |
setMapStyleContent { } / addSource + addLayer in style load | Sources and layers as map content inside Map { } |
location.options.puckType = .puck2D(...) | Puck2D(bearing: .heading) as map content |
location.override(provider:) | .locationDataModel(LocationDataModel(location:heading:)) |
ornaments.options.compass.visibility = .hidden | .ornamentOptions(OrnamentOptions(compass: CompassViewOptions(visibility: ...))) |
gestures.options.rotateEnabled = false | .gestureOptions(GestureOptions(rotateEnabled: false)) |
Anything else on mapView / mapboxMap | MapReader { proxy in ... }, then proxy.map, proxy.camera |
NavigationMapView, NavigationViewController | Host in UIViewControllerRepresentable (see references/navigation.md) |
mapbox-ios-patterns: building Maps features on iOS, in SwiftUI and UIKitmapbox-navigation-patterns: building navigation featuresmapbox-ios-maps-v10-to-v11-migration, mapbox-ios-navigation-v2-to-v3-migration: run these first on older SDKsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mapbox, ios, swiftui, uikit-migration, map-migration, navigation-sdk
npx claudepluginhub mapbox/mapbox-agent-skills --plugin mapbox27 skills in this plugin
/mapbox-android-compose-migrationMove Android Mapbox map and navigation screens from the View system (XML MapView, AndroidView-wrapped MapView, fragments) to Jetpack Compose with a coding agent. Covers the Mapbox parts of the screen (MapboxMap composable, viewport state, style and annotation composables, MapEffect, lifecycle, Navigation SDK v3 wiring) and leaves the rest of the screen to Google's XML-to-Compose skill. Keeps the map looking and behaving the same, one screen at a time. Use when migrating a Mapbox screen to Compose, planning that work, or fixing a map that broke after moving to Compose./mapbox-android-maps-v10-to-v11-migrationMigrate an Android app from Mapbox Maps SDK v10 to v11 with a coding agent. Inventories v10 usage, plans the work by area with effort and blockers, migrates one area at a time to the current recommended v11 APIs (Featureset Interactions, Feature State, typed events), surfaces behavior changes as developer decisions, keeps the app's style, and reports what changed. Covers Kotlin, Java, Views and Jetpack Compose. Use when upgrading Maps SDK v10 on Android, estimating a v10 to v11 migration, or fixing a build after bumping to v11.Other plugins' skills for the same job