04
Product
16
Backend
09
Auth
12
iOS
07
Infra
02
Real-Time

Use MapKit Place ID for accommodation references

ADR-0037 ACCEPTED · 2025-10-07
Use MapKit Place ID for accommodation references

Context

The app captures accommodation bookings as part of destinations. The initial approach considered storing full location data (coordinates, address, name) for each hotel. This means our stored data goes stale when hotels change phone numbers, websites, or hours — and we'd need to pay for geocoding.

MapKit Place ID (iOS 16+) is a persistent reference to a place in Apple Maps. It's designed to last as long as the place exists, automatically resolves to fresh data, and works across iOS, macOS, web (MapKit JS), and server APIs. Resolution is free.

Decision

Store Apple Maps Place ID as the primary reference for accommodations, with minimal booking metadata alongside.

pub struct Accommodation {
    pub place_id: String,          // Apple Maps Place ID
    pub name: String,              // Display snapshot for offline
    pub check_in: NaiveDate,
    pub check_out: NaiveDate,
    pub confirmation_number: Option<String>,
}

Place ID is source of truth — resolve for fresh data online, fall back to cached name offline. iOS handles search via MKLocalSearchCompleter (filtered to destination region) and display via MKMapItemRequest which gives Place Cards with hours, phone, website, and photos automatically.

Bonus: MKMapItem.placemark.subLocality gives the neighborhood for free — "Lisbon (staying in Bairro Alto)" without separate enrichment.

Consequences

Zero storage overhead (just an ID string), always-fresh data, no geocoding needed, rich UI via Place Cards for free. Cross-platform via MapKit JS and server API.

The trade-off is Apple Maps dependency — hotels not in Apple Maps won't have Place IDs, and fresh data requires network (offline shows the cached name only).