Contents

cycling

Directions suitable for use while cycling.

Declaration

static var cycling: MKDirectionsTransportType { get }

Discussion

Use this transportation type to request cycling directions between locations.

The following example shows a task that requests directions between two locations.

  // Bethesda Terrace in Central Park, New York, NY, United States
  let origin = MKMapItem(location: .init(latitude: 40.77396, longitude: -73.97097), address: nil)

  // Grand Central Terminal, New York, NY, United States
  let destination = MKMapItem(location: .init(latitude: 40.7528, longitude: -73.97715), address: nil)

  Task {
      let request = MKDirections.Request()
      request.transportType = .cycling
      request.source = origin
      request.destination = destination
      directions = try? await MKDirections(request: request).calculate()
  }

See Also

Transport types