feat(ios): add feature state api#4420
Open
MarkusWendorf wants to merge 3 commits into
Open
Conversation
MarkusWendorf
marked this pull request as ready for review
July 20, 2026 21:05
Member
|
Thanks Markus. I think an implementation that aligns with Android makes more sense. Will have a look at this tomorrow. |
MarkusWendorf
commented
Jul 20, 2026
| // Toggle the selection state of the tapped feature. Selection is not | ||
| // exclusive: any number of states can be selected at the same time. | ||
| let isSelected = statesSource.featureState(featureID: featureID)?["selected"] as? Bool ?? false | ||
| statesSource.setFeatureState(featureID: featureID, state: ["selected": !isSelected]) |
Contributor
Author
There was a problem hiding this comment.
@louwers not sure if I jumped the shark here but I assumed your PR is out-dated now that the source centric API from Android was merged.
Contributor
Bloaty Results 🐋Compared to main Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-4420-compared-to-main.txtCompared to d387090 (legacy) Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-4420-compared-to-legacy.txt |
Contributor
|
Benchmark Results ⚡ Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-4420-compared-to-main.txt |
Contributor
Bloaty Results (iOS) 🐋Compared to main Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-4420-compared-to-main.txt |
zhengxuehua424-debug
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements feature state for iOS. feature-state was already implemented in the core.
This is an alternative implementation to #3858, deliberately aligned with the API shape that shipped for Android in #4219.
I also added a vector-tile example to Android, so that we now have a GeoJSON example AND a vector-tile example for feature-state on both iOS and Android.
Tests added:
MLNFeatureStateTests.testFeatureStateRoundTrip (integration test through the Swift source
API).
Query.RemoveSourceFeatureState (set/get round-trip and key-/feature-level removal via the
renderer).
that a feature-state change actually alters rendered pixel output through a data-driven
["case", ["boolean", ["feature-state", "active"], …]] fill-color expression.
Co-authored with AI: Anthropic Fable/Opus 4.8