TKDeparturesProvider

@objc
public class TKDeparturesProvider : NSObject

Undocumented

  • Filter to apply to the results, treated as an “AND” condition.

    See more

    Declaration

    Swift

    public struct Filter : Codable
  • Undocumented

    See more

    Declaration

    Swift

    public enum InputError : Error
  • Undocumented

    See more

    Declaration

    Swift

    public enum OutputError : Error

Departures.json for stops

  • Fetches departures from one or more stops, using the departures.json API

    Declaration

    Swift

    public static func fetchDepartures(stopCodes: [String], fromDate: Date, filters: [Filter] = [], limit: Int = 10, in region: TKRegion) async throws -> TKAPI.Departures

    Parameters

    stopCodes

    Stop codes, which have to be in the same region

    fromDate

    Date of first departure to fetch

    filters

    Optional filters, that are treated as an “OR” condition.

    limit

    Maximum number of departures to fetch; not that API might return more than that if multiple departures are at the same time. Defaults to 10.

    region

    Region that the stops are in

    Return Value

    API response of departures from those stops

  • Undocumented

    Declaration

    Swift

    public static func downloadDepartures(for stops: [StopLocation], fromDate: Date, filters: [Filter] = [], limit: Int = 10) async throws -> Bool

Departures.json for stop-to-stop

API to Core Data

  • Undocumented

    Declaration

    Swift

    public static func addDepartures(_ departures: TKAPI.Departures, to stops: [StopLocation]) -> Bool
  • Undocumented

    Declaration

    Swift

    public static func addDepartures(_ departures: TKAPI.Departures, into context: NSManagedObjectContext) -> Set<String>