mapbox / mapbox/mapbox-maps-ios

"Failed to create LayerType" when using allLayerIdentifiers with custom layer added

Open
#1,768 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

## Environment

- Xcode version: 14.1
- iOS version: any
- Devices affected: any
- Maps SDK Version: 10.9.1

## Observed behavior and steps to reproduce

1. Implement custom layer with `CustomLayerHost`
2. Add custom layer to the chart
3. Get layers identifiers: `let identifiers = mapView.mapboxMap.style.allLayerIdentifiers`
4. Get the `Failed to create LayerType from type custom` error

## Expected behavior

1. You get the list of layers

## Notes / preliminary analysis
1. Custom layers have `custom` type
2. There is no such type in [LayerType.swift](https://github.com/mapbox/mapbox-maps-ios/blob/main/Sources/MapboxMaps/Style/LayerType.swift).

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 Sources/MapboxMaps/Style/LayerType.swift and the mapView.mapboxMap.style.allLayerIdentifiers entry point. Reproduce the issue using CustomLayerHost and a custom layer, then trace how the custom type is handled when identifiers are converted to LayerType. Done means all layer identifiers can be retrieved without the "Failed to create LayerType" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.