Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enum for layer position #221

Merged
merged 4 commits into from
May 17, 2021
Merged

Add enum for layer position #221

merged 4 commits into from
May 17, 2021

Conversation

julianrex
Copy link
Contributor

@julianrex julianrex commented Mar 26, 2021

PRs must be submitted under the terms of our Contributor License Agreement CLA.

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-ios changelog: <changelog>Added new LayerPosition enum which improves Swift ergonomics.</changelog>.
  • Update the migration guide, API Docs, Markdown files - Readme, Developing, etc

Summary of changes

This PR adds a LayerPosition enum that shadows the underlying MapboxCoreMaps.LayerPosition struct to improve the Swift ergonomics of function calls.

For example, the layerPosition parameter in the following function call

mapView.style.addCustomLayer(
    withId: "Custom",
    layerHost: self,
    layerPosition: LayerPosition(above: nil, below: "waterway-label", at: nil))

becomes

layerPosition: .below("waterway-label"))

@julianrex julianrex added the breaking change ⚠️ If your pull request introduces a breaking change and updates are required when version is published label Mar 26, 2021
@julianrex
Copy link
Contributor Author

cc @tobrun

@julianrex julianrex marked this pull request as ready for review May 17, 2021 14:15
let annotationManager = AnnotationManager(for: mapView,
mapEventsObservable: mapView.mapboxMap,
with: self)
with: self,
options: AnnotationOptions(layerPosition: .at(requiredIndex)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need another test that specifically adds an annotation above location indicator Layer or vice-versa. And then we can get the stack and check for the order there as the assertion. That was a specific use case and would be an impactful test.

Further, this PR is going to warrant a Migration Guide change. Can we make that and link that PR as part of this ticket somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we address this with upcoming annotation changes? /cc @nishant-karajgikar?

@julianrex julianrex merged commit e424bf3 into main May 17, 2021
@julianrex julianrex deleted the jrex/layerPosition branch May 17, 2021 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change ⚠️ If your pull request introduces a breaking change and updates are required when version is published p0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants