mapbox / mapbox/mapbox-maps-ios

Support for transition for data-driven properties

Open
#2,157 1 comment 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

## Environment

- Xcode version: 15.3
- iOS version: 17.4
- Devices affected: iPhone 15 Pro
- Maps SDK Version: 11.1.0

## Observed behavior and steps to reproduce

Transitions don't seem to function at all when layer properties are set using expressions rather than constant values.

```swift
var layer = SymbolLayer(id: layerId, source: sourceId)
layer.iconImage = "icon"
layer.iconOpacity = .expression(Exp(.step) {
Exp(.zoom)
0
15
1
})
layer.iconOpacityTransition = StyleTransition(duration: 1, delay: 0)
```

## Expected behavior

I'd expect the opacity to fade in and out when zooming past the specified zoom level.
The transition works properly if you use an `onCameraChanged` listener and set the value to a constant instead.

## Notes / preliminary analysis

This may be related to similar issues in [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js/issues/3170) and [rnmapbox](https://github.com/rnmapbox/maps/issues/2102).

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 Swift SymbolLayer expression and StyleTransition APIs shown in the report, and compare them with the constant-value path and the onCameraChanged workaround. Confirm the behavior around zoom changes and determine what must change so iconOpacity transitions when driven by an expression; done means the reported fade-in and fade-out behavior works for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.