Skip to content

[New] Sample: Navigate map view and identify features with keyboard#786

Open
chriswebb09 wants to merge 65 commits into
v.nextfrom
chrisw/navigate-and-interact-with-keyboard
Open

[New] Sample: Navigate map view and identify features with keyboard#786
chriswebb09 wants to merge 65 commits into
v.nextfrom
chrisw/navigate-and-interact-with-keyboard

Conversation

@chriswebb09

@chriswebb09 chriswebb09 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR implements Navigate map view and identify features with keyboard in Accessibility category.
URL to README:

Here

Linked Issue(s)

  • swift/issues/8255

Screenshots

navigate-map-view-and-identify-features-with-keyboard

@chriswebb09 chriswebb09 self-assigned this Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread Samples.xcodeproj/project.pbxproj
Comment thread Samples.xcodeproj/project.pbxproj
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

chriswebb09 and others added 2 commits June 15, 2026 08:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chriswebb09 chriswebb09 requested a review from Copilot June 29, 2026 16:11
@chriswebb09 chriswebb09 removed the request for review from philium June 29, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Comment thread Shared/Samples/Navigate map view and identify features with keyboard/README.md Outdated
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 yo1995 removed their request for review June 30, 2026 22:17

@yo1995 yo1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I talked to Phil R and he'll review this PR instead of me.

@yo1995 yo1995 requested review from philium and yo1995 June 30, 2026 22:20
chriswebb09 and others added 3 commits June 30, 2026 15:29
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants