# GooglePlacesSwift Framework Reference

# RoutingPreference

    enum RoutingPreference

    extension RoutingPreference : CaseIterable, Copyable, Equatable, Escapable, Hashable, RawRepresentable, Sendable, SendableMetatype

A set of values that specify factors to take into consideration when calculating the routes.
- `


  ### [AllCases](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO8AllCasesa)


  ` A type that can represent a collection of all values of this type.

  #### Declaration

  Swift

      typealias AllCases = [RoutingPreference]

- `


  ### [RawValue](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO8RawValuea)


  ` The raw type that can be used to represent all values of the conforming
  type.

  Every distinct value of the conforming type has a corresponding unique
  value of the `RawValue` type, but there may be values of the `RawValue`
  type that don't have a corresponding value of the conforming type.

  #### Declaration

  Swift

      typealias RawValue = Int

- `


  ### [allCases](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO8allCasesSayACGvpZ)


  ` A collection of all values of this type.

  #### Declaration

  Swift

      nonisolated static var allCases: [RoutingPreference] { get }

- `


  ### [init(rawValue:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO8rawValueACSgSi_tcfc)


  ` Creates a new instance with the specified raw value.

  If there is no value of the type that corresponds with the specified raw
  value, this initializer returns `nil`. For example:

      enum PaperSize: String {
          case A4, A5, Letter, Legal
      }

      print(PaperSize(rawValue: "Legal"))
      // Prints "Optional(PaperSize.Legal)"

      print(PaperSize(rawValue: "Tabloid"))
      // Prints "nil"

  #### Declaration

  Swift

      init?(rawValue: Int)

  #### Parameters

  |---|---|
  | ` rawValue ` | The raw value to use for the new instance. |

- `


  ### [rawValue](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO8rawValueSivp)


  ` The corresponding value of the raw type.

  A new instance initialized with `rawValue` will be equivalent to this
  instance. For example:

      enum PaperSize: String {
          case A4, A5, Letter, Legal
      }

      let selectedSize = PaperSize.Letter
      print(selectedSize.rawValue)
      // Prints "Letter"

      print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
      // Prints "true"

  #### Declaration

  Swift

      var rawValue: Int { get }

- `


  ### [trafficAware](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO12trafficAwareyA2CmF)


  ` Calculates routes taking live traffic conditions into consideration. In contrast to
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference.html#/s:17GooglePlacesSwift17RoutingPreferenceO19trafficAwareOptimalyA2CmF`, some optimizations are applied to significantly reduce latency.

  #### Declaration

  Swift

      case trafficAware

- `


  ### [trafficAwareOptimal](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO19trafficAwareOptimalyA2CmF)


  ` Calculates the routes taking live traffic conditions into consideration, without applying
  most performance optimizations. Using this value produces the highest latency.

  #### Declaration

  Swift

      case trafficAwareOptimal

- `


  ### [trafficUnaware](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO14trafficUnawareyA2CmF)


  ` Computes routes without taking live traffic conditions into consideration. Suitable when
  traffic conditions don't matter or are not applicable. Using this value produces the lowest
  latency.

  Important note when using the `drive` and `twoWheeler` travel modes that are specified in
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/TravelMode.html`. The route and duration chosen are based on road network and average
  time-independent traffic conditions, not current road conditions. Consequently, routes may
  include roads that are temporarily closed. Results for a given request may vary over time
  due to changes in the road network, updated average traffic conditions, and the distributed
  nature of the service. Results may also vary between nearly-equivalent routes at any time or
  frequency.

  #### Declaration

  Swift

      case trafficUnaware

- `


  ### [unspecified](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference#/s:17GooglePlacesSwift17RoutingPreferenceO11unspecifiedyA2CmF)


  ` No routing preference specified. Default to `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/RoutingPreference.html#/s:17GooglePlacesSwift17RoutingPreferenceO14trafficUnawareyA2CmF`.

  #### Declaration

  Swift

      case unspecified