[New] Sample: Navigate map view and identify features with keyboard#786
Open
chriswebb09 wants to merge 65 commits into
Open
[New] Sample: Navigate map view and identify features with keyboard#786chriswebb09 wants to merge 65 commits into
chriswebb09 wants to merge 65 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Accessibility-focused sample demonstrating how to navigate a MapView and identify nearby features using keyboard-only input, including selecting features in a centered area of interest and showing details via number-key shortcuts.
Changes:
- Introduces a new SwiftUI sample view that queries and selects nearby restaurant features, labels up to nine in reading order, and handles number/Esc key presses to show/dismiss a callout.
- Adds accompanying README and metadata for the new sample (description, tags, relevant APIs, screenshot, snippet reference).
- Updates the Xcode project to include the new sample source in build sources and the “Copy Source Code Files” phase.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Shared/Samples/Navigate map view and identify features with keyboard/README.metadata.json | Adds sample catalog metadata (category, keywords, APIs, snippet). |
| Shared/Samples/Navigate map view and identify features with keyboard/README.md | Adds end-user documentation describing keyboard interaction and behavior. |
| Shared/Samples/Navigate map view and identify features with keyboard/NavigateMapAndIdentifyFeaturesWithKeyboardView.swift | Implements the keyboard navigation/identify workflow, selection, labeling, and callout presentation. |
| Samples.xcodeproj/project.pbxproj | Registers the new sample source file in the project and copy-sources build phase. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+76
to
+80
| /// Selects, numbers, and labels restaurant features that intersect a given envelope. | ||
| /// - Parameters: | ||
| /// - envelope: The envelope used to query restaurant features. | ||
| /// - screenPointFor: A closure that converts a map location to a screen point. | ||
| func selectFeatures(in envelope: Envelope?, screenPointFor: (Point) -> CGPoint?) async throws { |
Comment on lines
+138
to
+142
| .sorted { lhs, rhs in | ||
| // Sort by geographic coordinates (north to south, then west to east). | ||
| if lhs.anchor.y != rhs.anchor.y { | ||
| return lhs.anchor.y > rhs.anchor.y | ||
| } |
Comment on lines
+226
to
+230
| /// Makes an envelope matching the centered selection rectangle's map footprint. | ||
| private func makeSelectionEnvelope(mapSize: CGSize, mapViewProxy: MapViewProxy) -> Envelope? { | ||
| let clampedRectangleLength = min(selectionRectangleLength, min(mapSize.width, mapSize.height)) | ||
| let screenCenter = CGPoint(x: mapSize.width / 2, y: mapSize.height / 2) | ||
| let halfLength = clampedRectangleLength / 2 |
yo1995
reviewed
Jun 30, 2026
yo1995
left a comment
Collaborator
There was a problem hiding this comment.
I talked to Phil R and he'll review this PR instead of me.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Description
This PR implements
Navigate map view and identify features with keyboardinAccessibilitycategory.URL to README:
Here
Linked Issue(s)
swift/issues/8255Screenshots