Skip to main content

Maps & Location

Add interactive maps, directions, place search, and location tracking using Apple’s built-in frameworks.

What You Can Build

  • Map Display — Show maps with markers
  • User Location — Track where users are
  • Directions — Route calculation and navigation
  • Place Search — Find locations by name
  • Geocoding — Convert addresses to coordinates

Built-In vs External

Apple MapKit (Built-In)

Pros:
  • No API key needed
  • Free (included in iOS)
  • Privacy-focused
  • Native performance
Cons:
  • iOS only
  • Limited customization
  • No Street View

Google Maps (External)

Pros:
  • More detailed in some areas
  • Street View
  • Cross-platform
Cons:
  • Requires API key
  • Has usage costs
  • More setup
Recommendation: Start with Apple MapKit. It covers most needs and is easier to set up.

Displaying a Map

Basic Map

Map with Markers

Customizing the Map


User Location

Requesting Permission

Permission is required to access location:
  • When In Use — Only while app is open
  • Always — Even in background (rarely needed)

Getting Current Location

Tracking Location


Search by Name

Search Nearby


Directions

Getting Directions

Multiple Routes

Turn-by-Turn Instructions


Geocoding

Address to Coordinates

Coordinates to Address


Map Annotations

Custom Markers

Marker Details

Clustering


Common Use Cases

Store Locator

Delivery Tracking

Location Check-In


Location Settings

Accuracy Levels

Background Location

Background location drains battery and requires special justification for App Store approval. Only use if truly necessary.

Privacy Considerations

Permission Best Practices

  • Only request location when needed
  • Use “When In Use” unless you need background
  • Explain why you need location
  • Work gracefully without location

Handling Denied Permission


Troubleshooting

  • Check internet connection
  • Verify map region is set
  • Check if map view is sized correctly
  • Is permission granted?
  • Simulator: Set location in Features menu
  • Real device: Check Privacy settings
  • Check the query isn’t empty
  • Try broader search terms
  • Verify network connection
  • Start and end points valid?
  • Route possible by selected mode?
  • Network connection available?

Testing Location

In Simulator

Set simulated locations:
  • Features → Location → Custom Location
  • Or choose preset (City Run, Freeway Drive)

On Device

Real device uses actual GPS. Walk around to test tracking.

Next Steps

Weather APIs

Add weather to location features

Supabase

Store location data in the cloud