Skip to content

Fix search suggestions ignoring selected region (#139)#140

Merged
aaronbrethorst merged 3 commits intomainfrom
constrain-search-region
Jan 19, 2026
Merged

Fix search suggestions ignoring selected region (#139)#140
aaronbrethorst merged 3 commits intomainfrom
constrain-search-region

Conversation

@aaronbrethorst
Copy link
Member

@aaronbrethorst aaronbrethorst commented Jan 19, 2026

Summary

  • Fixes Bug Report: Search suggestions ignore selected region #139: Search suggestions now respect the user's selected transit region instead of using MKCoordinateRegion(.world)
  • Adds required searchRegion property to OTPConfiguration
  • Uses MKLocalSearchCompleter.regionPriority = .required (iOS 18+) to strictly enforce results come only from the specified region

Changes

  • OTPConfiguration.swift: Added searchRegion: MKCoordinateRegion property and SwiftUI environment key
  • TripPlanner.swift: Injects search region into SwiftUI environment
  • SearchManager.swift: Accepts region in init, uses regionPriority = .required
  • SearchSheetView.swift: Reads region from environment with proper lazy initialization
  • Updated tests, previews, demo app, and documentation

Test plan

  • SwiftLint passes
  • Build compiles successfully
  • Manual test: Launch demo app with Seattle region, search for "coffee" - verify results are in Seattle area
  • Manual test: Switch to San Diego region, search for same term - verify results change to San Diego area

- Add required searchRegion property to OTPConfiguration
- Create SwiftUI environment key for search region propagation
- Update SearchManager to accept region in init and use
  MKLocalSearchCompleter.regionPriority = .required (iOS 18+)
- Update SearchSheetView to read region from environment
- Update tests, previews, demo app, and documentation
@aaronbrethorst aaronbrethorst force-pushed the constrain-search-region branch 2 times, most recently from f456983 to acdce00 Compare January 19, 2026 06:28
* Update GitHub CI Xcode version to 26.2
* Fix xcresult path in CI workflow
* Manually create simulator and use iPhone 16 Pro with iOS 26.2
@aaronbrethorst aaronbrethorst force-pushed the constrain-search-region branch from acdce00 to f7d20bb Compare January 19, 2026 06:37
@aaronbrethorst aaronbrethorst merged commit e862774 into main Jan 19, 2026
3 checks passed
@aaronbrethorst aaronbrethorst deleted the constrain-search-region branch January 19, 2026 06:46
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.

Bug Report: Search suggestions ignore selected region

1 participant