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.

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

    Declaration

    Swift

    typealias AllCases = [RoutingPreference]
  • 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
  • A collection of all values of this type.

    Declaration

    Swift

    nonisolated static var allCases: [RoutingPreference] { get }
  • 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.

  • 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 }
  • Calculates routes taking live traffic conditions into consideration. In contrast to trafficAwareOptimal, some optimizations are applied to significantly reduce latency.

    Declaration

    Swift

    case trafficAware
  • 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
  • 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 TravelMode. 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
  • No routing preference specified. Default to trafficUnaware.

    Declaration

    Swift

    case unspecified