mapbox / mapbox/mapbox-maps-ios

SwiftUI - Control over MapViewAnnotation z index

Open
#2,135 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged feature :green_apple:
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## New Feature

I'd like to have control over the z Index of each MapViewAnnotation. Currently, only the .selected modifier allows us to control which annotation gets pushed to the front, but that is of no use when dealing with a larger set of annotations where the order matters.
The current iOS docs (non-SwiftUI) tell us that the order of adding annotations determines their z index. Changing the order of MapViewAnnotations in a ForEvery loop does not seem to change their z index.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing SwiftUI MapViewAnnotation and the existing .selected modifier, then compare the behavior with the current iOS annotation-order documentation. Done means callers can control each annotation's z index independently, including when annotations are generated in a ForEach loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.