TKResultsFetcher

public class TKResultsFetcher

Fetches trips for a request

Also takes care of localising the user, if the query involves the user’s current location, and handles being hit multiple times with different requests by only returning results from the last requested query.

  • The progress of a single routing fetch request

    See more

    Declaration

    Swift

    public enum Progress : Equatable
  • Kicks off fetching trips, providing process via an observable stream.

    Note

    If the request is for “now”, the request will get modified by locking in the departure times.

    Note

    If the request uses the current location, the location will also get locked in.

    Declaration

    Swift

    public static func streamTrips(for request: TripRequest, modes: [String]? = nil, classifier: TKTripClassifier? = nil, additionalParameters: [URLQueryItem]? = nil, baseURL: URL? = nil) -> Observable<Progress>

    Parameters

    request

    The request for which to fetch trips

    classifier

    Optional classifier, see TKTripClassifier for more

    Return Value

    Stream of fetching the results, multiple call backs as different modes are fetched.

  • Create a new replacement location for the user’s fetched current location that can then be saved to the current TripRequest object.

    The recommendation is to check against the user’s favourites and use those if they are nearby, so that the user sees “From home” rather than “From some address near my home”.

    Declaration

    Swift

    public static var replacementHandler: (CLLocation) -> TKNamedCoordinate