mapbox / mapbox/mapbox-maps-ios

Question on how to correctly use ViewAnnotation

Open
#2,403 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have a ViewAnnotation which I created and added to MapView.
Now I would like to reposition this ViewAnnotation to new coordinates.

How can I do that? The ViewAnnotationManager.update(_:options:) seems to be capable of doing that, but it is marked as deprecated, and it tells me to use ViewAnnotation's properties.
I am looking at the available properties in the ViewAnnotation, and among them only one makes sense to me - ViewAnnotation.anchorCoordinate (link), which is actually a getter...

Am I supposed to call ViewAnnotation.onAnchorCoordinateChanged link ? Or there is some other API which I didn't notice that will allow me to reposition a ViewAnnotation?

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 with the linked ViewAnnotation and ViewAnnotationManager.update(_:options:) documentation, including anchorCoordinate and onAnchorCoordinateChanged. Confirm the supported way to reposition an existing annotation; done when the API usage and any required call sequence are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.