100 Days of SwiftUI

Day 70

2026-07-23

Project 14, part 3

All about Maps

Adding user locations to a map

We need to use onTapGesture because it’s a map, but in general for accessibility a button is preferred

  • TapGesture reports position in screen coordinates, so need to add MapReader to get map coordinates
  • does not interfere with other map gestures

Improving our map annotations

You can wrap example data used for XCode views in

# if DEBUG
static let example = ...
# endif

and it won’t be compiled into the final app code

Selecting and editing map annotations

LongPressGesture on one of the existing locations is good for going into some sort of “edit” sheet

samoyed sketchsamoyed sketch