Instance Method

calculateETA(completionHandler:)

Begins calculating the requested travel-time information asynchronously.

Declaration

func calculateETA(completionHandler: @escaping MKDirections.ETAHandler)

Parameters

completionHandler

The block to execute when the travel-time estimate is ready or when an error occurs. This parameter must not be nil.

Discussion

This method initiates a request for a travel-time estimate and calls your completion handler block with the results. Travel-time estimates take much less time to generate than directions, so use this method in situations where you want a time estimate only. Your completion handler is executed on your app’s main thread. The implementation of your handler should check for errors and then incorporate the response data as appropriate.

If you call this method while a previous request is in process, this method calls your completion handler with an error. You can determine if a request is in process by checking the value of the isCalculating property. You can also cancel a request as needed.

See Also

Getting the ETA

typealias MKDirections.ETAHandler

The block to use for processing travel-time information.

class MKDirections.ETAResponse

The travel-time information returned by Apple servers.