public class TKUIResultsFetcher
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 requestSee more
public enum Progress : Equatable
Kicks off fetching trips, providing process via an observable stream.
NoteIf the request is for “now”, the request will get modified by locking in the departure times.
If the request uses the current location, the location will also get locked in.
public static func streamTrips(for request: TripRequest, modes: Set<String>? = nil, classifier: TKTripClassifier? = nil, baseURL: URL? = nil) -> Observable<Progress>
The request for which to fetch trips
The modes to enable. If set to
nilthen it’ll use the modes as set in the user defaults (see
Optional classifier, see
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
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”.
public static var replacementHandler: (CLLocation) -> TKNamedCoordinate
Replace the set of provided modes with the modes returned by the
Single, called before by
streamTripsat the very start and information is not cached.
public static var modeReplacementHandler: ((TKRegion, Set<String>) -> Single<Set<String>>)?