Docs
Media

Map ExpandNew

A place card whose map thumbnail opens into a live MapKit map, the pin dropping in and your actions settling under it.

By

Map Expand: SwiftUI Expandable Map Card for iOS, live preview in light mode

Map Expand, a SwiftUI Expandable Map Card for iOS 17+, in its live preview. Open Code for the Swift source.

$npx swiftpieces add MapExpand
Free · MIT + Commons ClauseiOS 17.0+Liquid Glassmapmapkitlocationplacepinexpanddirections
Type
MapExpand
Files
MapExpand.swift
Depends on
Nothing (Apple frameworks only)
Version
1.0.0

Sizes and colors for MapExpand.

Notes

  • Uses MapKit, so the map is real at every size: a thumbnail in the card, then a live, draggable map that fills the space once it opens.
  • Tap the card to open it. The pin drops into place with a bounce, the card floats down onto the map as liquid glass, and your actions bud out of it one after another into a joined glass bar. Back, a glass button on the map, draws them in and folds it all into the card again.
  • Pass actions as MapExpandActions. Mark one isPrimary, such as Directions: it is the wide pill in the pin's colour, and the rest are square glass buttons that use their title as the VoiceOver label.
  • It fills the space it is given, with the card at the top and your content under it; the page fades while the map is open.
  • style.span sets how far the map is zoomed out, in meters across. Points of interest and map controls are hidden, so the pin reads first.
  • On iOS 26 the card and actions are Liquid Glass and merge as they move; before that they are frosted and don't merge. Under Reduce Transparency they are solid.
  • VoiceOver gets Open map and Close map actions. Under Reduce Motion the pin appears without dropping and nothing bounces.

Usage

MapExpandExample()

Install

Pick one. Run it from the folder that contains your .xcodeproj and the files land inside your app.

Terminal

$npx swiftpieces add MapExpand

Or ask your coding agent · Claude Code, Cursor or Xcode, once the MCP server is connected

>Add the SwiftPieces "Map Expand" piece to my app

Or copy the source above into your app.

New to SwiftUI?If you know React, CSS or Tailwind, SwiftUI is easier to pick up than it looks.Try real app patterns first

Building a whole app? See SwiftPieces Pro →

All media →

Build it yourself: SwiftUI animations guide

On this page

SwiftPiecesPro

Build the whole app with one library.

Production-ready screens, whole flows, complete app templates, a Build Kit your agent follows and Pro remixing.

Explore Pro