I have the following code that I've just added tracking mode to.
struct LocationInfoView: View {
  @State var location: CLLocationCoordinate2D
  @State private var mapRegion: MKCoordinateRegion
  @State private var trackingMode = MapUserTrackingMode.follow
  let markers: [Marker]
  init(location: CLLocationCoordinate2D) {
    self.location = location
    mapRegion = MKCoordinateRegion(center: location, span: MKCoordinateSpan(latitudeDelta: 0.00625, longitudeDelta: 0.00625))
    markers = [Marker(location: MapPin(coordinate: location))]
  }
  var body: some View {
    Map(
      coordinateRegion: $mapRegion,
      showsUserLocation: true,
      userTrackingMode: $trackingMode,
      annotationItems: markers) { marker in
        marker.location
      }
      .edgesIgnoringSafeArea(.bottom)
  }
}
struct Marker: Identifiable {
  let id = UUID()
  var location: MapPin
}
The moment I add the MapUserTrackingMode I get Variable 'self.location' used before being initialized and Variable 'self.mapRegion' used before being initialized errors. I don't understand why adding the tracking mode causes an issue with initialization.
 
    