ImmersiveMap: a vector map engine for iOS and macOS, written from scratch in Swift and Metal (MIT)

ImmersiveMap: a vector map engine for iOS and macOS, written from scratch in Swift and Metal (MIT)

For the last few years I've been writing a **map rendering engine** in **Swift** and **Metal**, because on Apple platforms you either take the closed system framework or a large shared C++ codebase with a Swift wrapper on top. I wanted one that is Swift and Metal all the way down.

The engine is **MIT licensed** and renders **vector tiles** in the **OpenMapTiles** schema: run your own tileserver, or point it at a public one.

**What it does**: flat map and globe in one continuous zoom, labels, 3D buildings with shadows, glTF models placed at real coordinates. Swift 6, iOS 18 and macOS 15.

Repo: [github.com/artembobkin/ImmersiveMap](http://github.com/artembobkin/ImmersiveMap)

Happy to answer anything about the engine.

If you need something the engine doesn't do yet, open an issue or just ask in the thread.

u/devslacker — 9 days ago

A cow standing on the Champ de Mars in my own OpenStreetMap renderer

This is ImmersiveMap, a vector-tile renderer I write in Swift + Metal, no game engine and no third-party map SDK underneath. Tiles are OpenStreetMap data served as MVT through OpenMapTiles

MIT: github.com/artembobkin/ImmersiveMap

u/devslacker — 13 days ago

Open source Swift + Metal map engine for SwiftUI. I am looking for real app use cases from anyone who needs more than MapKit gives them

I have been building ImmersiveMap, an open source map rendering engine written in Swift 6 and Metal, made for SwiftUI apps on iOS and native macOS. MIT licensed.

Video demo in the comments.
Repo: github.com/artembobkin/ImmersiveMap

I am looking for real apps that need more control over the map, where the map is the main feature. Live location, social maps, games, travel, logistics, data visualization, anything where the map has to look and behave like your product instead of like everyone else's map.

Tell me your use case here in the comments or in Discussions on the repo, and I will build it. I am prioritizing real app requirements over my own roadmap. Right now it already supports SwiftUI markers and avatars on the map.

Pure Swift and Metal, nothing else. No native SDK wrapped in a Swift API and no engine hidden under the hood, two Swift dependencies (earcut triangulation and swift-protobuf for tile decoding). The only non-Swift code in the repo is the shaders themselves.

Happy to answer any questions.

u/devslacker — 20 days ago
▲ 106 r/SwiftUI

ImmersiveMap - a Metal-rendered SwiftUI map for iOS & macOS with live markers (open source, alpha)

I've been building ImmersiveMap, a map component you can drop into a SwiftUI app - think Mapbox / MapLibre, but rendered natively for Apple platforms. It hands you a plain SwiftUI view with modifiers, so it composes like any other SwiftUI component on iOS and macOS.

What it can do so far:

  • Show a full interactive vector map (streets, buildings, water, labels) as either a flat map or a 3D globe
  • Camera control straight from SwiftUI: pan, zoom, rotate and tilt
  • Place custom markers / avatars on real coordinates and move them in real time - handy for live-location and social features (friends on a map, driver/delivery tracking, and so on)
  • Grouping: several avatars can merge into a single marker that follows their moving average (that's the marker sliding around in the clip)

It's alpha - the API will still change and there are rough edges - but it already feels smooth and responsive to use, so I wanted to share it and get feedback.

Repo (MIT): https://github.com/artembobkin/ImmersiveMap

Curious what SwiftUI folks think, and what you'd want from a native map component. Happy to answer any questions.

^(If it turns out useful, a GitHub star would genuinely help - I'd love to get it onto the awesome-swiftui list one day, and that list runs on stars.)

u/devslacker — 1 month ago

Morphing between a globe and a flat map in the vertex shader (Swift + Metal)

The video shows a vector map going from a globe to a flat map and back with no hard cut. Here's how the morph works.

Every tile vertex has a lat/lon. In the vertex shader I compute two target positions for it:

  • P_sphere - the point on the unit sphere for that lat/lon, placed by the globe transform
  • P_plane - its Web-Mercator position on a flat plane

Then I just lerp between them:

P = mix(P_plane, P_sphere, t)

where t in [0,1] is driven by zoom (t = 0 zoomed into a city, t = 1 zoomed out to the whole planet). Both targets come from the same lat/lon per vertex, so there's no "switch" frame - the geometry continuously unrolls. Normals are blended the same way, so shading and the horizon stay consistent through the transition.

The hard part is precision. At t = 0 you're on a plane at street scale; at t = 1 on a planet-radius sphere, and naive float32 world coords wobble in between. I keep vertices camera/tile-relative instead of absolute planet coordinates to stay in a sane float range.

Context: pulled from an open-source Swift + Metal map engine, tiles are MVT. Source (MIT): github.com/artembobkin/ImmersiveMap

u/devslacker — 1 month ago