Repository navigation
Let ImageIcon and GroundImageState take an image URL - #24
Merged
Merged
Conversation
ImageIcon(imageUrl:) and GroundImageState(bounds:imageUrl:) load the image themselves through one shared loader: each URL is fetched once, finished images are cached, failures are remembered and logged once per URL. An icon is a transparent image of the same size and anchor until its image arrives. Its hashCode mixes in the load state (pending / ready / failed), so it changes exactly once; MarkerState then re-assigns the same icon, which redraws through the usual icon-change path (StateMutationSignal and $icon). A marker whose icon was replaced in the meantime is left alone. A ground image shows a 1x1 transparent image until loaded, then the image is assigned to `image`. Changing imageUrl keeps the current image until the new one arrives and drops stale results; assigning `image` clears imageUrl. The generated id comes from the URL so it is stable across the load. API: additions only in behaviour. ImageIcon.init(image:) becomes a convenience initializer of the final class (same signature) so both inits share one designated initializer.
The ImageIcon / GroundImageState URL baseline was dumped with Xcode 27.2 (27B52). Re-dumping the whole baseline with 27.2 changes no other line, so this commit only updates the record.
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.
ImageIcon(imageUrl:…)andGroundImageState(bounds:imageUrl:…)load their image from a URL. Same design as js-sdk-core and android-sdk-core.Behaviour
RemoteImageLoader: one URLSession fetch per URL (file URLs too),NSCacheof 256, failures remembered and logged once, one-shot callbacks on the main thread. Tests can inject the fetch.hashCode()= URL + parameters + load state, so it changes exactly once.copy()keeps the URL unlessimage:is passed.@Published imageUrl: URL?. A 1×1 transparent placeholder until loaded, thenimageis assigned. ChangingimageUrlkeeps the current image until the new one arrives; stale results are dropped. Assigningimageyourself clearsimageUrl. Default id is derived from the URL.GroundImage(bounds:imageUrl:…)overload inMapLayerItems.API
ImageIcon.init(image:)became aconvenienceinit so both inits share one designated init (signature unchanged, class isfinal); the rest is additions. Baseline dumped with Xcode 27.2; the second commit records 27.2 inapi/TOOLCHAIN(re-dumping with 27.2 changes no other line). Note:test.ymlpins Xcode fromTOOLCHAIN, so runs on PRs tomainneedXcode_27.2.appon the runner.Verification
xcodebuild test: 327 pass (8 new inImageUrlLoadingTests).