mapbox / mapbox/mapbox-maps-ios
Add paired `will..` event hooks before actual event occurs
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 601
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
## New Feature
Add the following `EventKinds` and pair them with `mapLoaded` and `cameraChanged` respectively:
```
enum EventKind: RawRepresentable, CaseIterable {
case mapWillLoad
case cameraWillChange
}
```
Both Apple (`-[MKMapViewDelegate mapView:regionWillChangeAnimated:]`) and Mapbox < V10 (`-[MGLMapViewDelegate mapView:regionWillChangeAnimated:]`) have events that fire before the actual event occurs. This allows developers to track state changes in a more detailed fashion, perform cleanup actions, and closes the API gap with Mapbox < V10.
## Why
Adding this functionality allows for backwards API compatibility. Mapbox versions < 10 has the `mapView:regionWillChangeAnimated:` and `mapViewWillStartLoadingMap:` delegate methods.
Furthermore, `will` event hooks allow 3rd party developers to clean up any views that may be blocking the map view. For example, after interacting with a context menu, the developer would want to dismiss the menu as soon as the map will move after a user gesture.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate EventKind and the existing mapLoaded and cameraChanged event definitions, then trace where those events are emitted. Done means adding mapWillLoad and cameraWillChange and pairing them with the corresponding events so they fire beforehand, matching the described Apple and pre-v10 Mapbox behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- api, mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100