Reactive

extension Reactive where Base: NSManagedObjectContext
extension Reactive where Base == TKBuzzInfoProvider
extension Reactive where Base: TKRealTimeFetcher
public extension Reactive where Base == TKGeocoderHelper
extension Reactive where Base: MKLocalSearch
public extension Reactive where Base : TKLocationManager
extension Reactive where Base : TKBikePodLocation
extension Reactive where Base : TKCarPodLocation
extension Reactive where Base : TKCarParkLocation
extension Reactive where Base : TKFreeFloatingVehicleLocation
extension Reactive where Base == TKReporter
extension Reactive where Base == TKTripFetcher
extension Reactive where Base : TKRouter
extension Reactive where Base: TKRegionManager
extension Reactive where Base: TKServer
extension Reactive where Base == TKSettings
extension Reactive where Base == TKUITripMonitorManager

Available where Base: NSManagedObjectContext

Available where Base == TKBuzzInfoProvider

  • Undocumented

    Declaration

    Swift

    public static func downloadContent(of service: Service, forEmbarkationDate date: Date, in region: TKRegion) -> Single<Void>
  • Asynchronously fetches transit alerts for the provided region using Rx.

    Declaration

    Swift

    public static func fetchTransitAlerts(forRegion region: TKRegion) -> Single<[TKAPI.Alert]>
  • Undocumented

    Declaration

    Swift

    public static func fetchTransitAlertMappings(forRegion region: TKRegion) -> Single<[TKAPI.AlertMapping]>

Available where Base: TKRealTimeFetcher

  • Stream real-time updates for the trip

    Declaration

    Swift

    public static func streamUpdates(_ trip: Trip, updateInterval: DispatchTimeInterval = .seconds(10), active: Observable<Bool> = .just(true)) -> Observable<Trip>

    Parameters

    trip

    The trip to update

    updateInterval

    The frequency at which the trip should be updated (default is every 10 seconds)

    active

    Optional stream whether updates should keep being performed, e.g., you can create a bunch of these, but only the active one will be updated. It’s expected that these go back and forth between true and false

    Return Value

    Stream of the trip, whenever it gets updated, i.e., if there’s no update the stream won’t fire.

  • Perform one-off real-time update of the provided trip

    No need to call this if trip.wantsRealTimeUpdates == false. It’d just complete immediately.

    Declaration

    Swift

    public static func update(_ trip: Trip) -> Single<(Trip, didUpdate: Bool)>

    Parameters

    trip

    The trip to update

    Return Value

    One-off callback with the update. Note that the Trip object returned in the callback will always be the same object provided to the method, i.e., trips are updated in-place.

  • Perform one-off updates of the visible trips of each trip group

    Declaration

    Swift

    public static func update(tripGroups: [TripGroup]) -> Observable<TKRealTimeUpdateProgress<Void>>

    Parameters

    tripGroups

    Trip groups, where only the visible trip will be updated

    Return Value

    Progress of the update, but it won’t indicate which trips did get updated

Available where Base == TKGeocoderHelper

  • Undocumented

    Declaration

    Swift

    static func geocode(_ object: TKGeocodable, using geocoder: TKGeocoding, near region: MKMapRect) -> Single<Void>

Available where Base: MKLocalSearch

  • Undocumented

    Declaration

    Swift

    public func start() -> Single<[MKMapItem]>

Available where Base : TKLocationManager

  • Fetches the user’s current location and fires observable exactly ones, if successful, and then completes.

    The observable can error out, e.g., if permission was not granted to the device’s location services, or if no location could be fetched within the alloted time.

    Declaration

    Swift

    func fetchCurrentLocation(within seconds: TimeInterval) -> Single<CLLocation>

    Parameters

    seconds

    Maximum time to give GPS

    Return Value

    Observable of user’s current location; can error out

  • Continuously observes the user’s current location and fires observable whenever the user moved more than a minimum threshold.

    The observable can error out, e.g., if permission was not granted to the device’s location services.

    Declaration

    Swift

    var currentLocation: Observable<CLLocation> { get }

    Return Value

    Observable of user’s current location; can error out

  • Observes the device’s heading

    The observable does not error out and not terminate by itself.

    Note

    Internally, each subscription creates a new observable, and a new location manager, so you’re encouraged to share a single subscription.

    Declaration

    Swift

    var deviceHeading: Observable<CLHeading> { get }
  • Undocumented

    Declaration

    Swift

    func tryAuthorization() -> Single<Bool>

Available where Base : TKBikePodLocation

  • Undocumented

    Declaration

    Swift

    public var bikePod: Observable<TKAPI.BikePodInfo> { get }

Available where Base : TKCarPodLocation

  • Undocumented

    Declaration

    Swift

    public var carPod: Observable<TKAPI.CarPodInfo> { get }

Available where Base : TKCarParkLocation

  • Undocumented

    Declaration

    Swift

    public var carPark: Observable<TKAPI.CarParkInfo> { get }

Available where Base : TKFreeFloatingVehicleLocation

  • Undocumented

    Declaration

    Swift

    public var vehicle: Observable<TKAPI.SharedVehicleInfo> { get }

Available where Base == TKReporter

Available where Base == TKTripFetcher

  • Undocumented

    Declaration

    Swift

    public static func downloadTrip(_ url: URL, identifier: String? = nil, into context: NSManagedObjectContext) -> Single<Trip>
  • Undocumented

    Declaration

    Swift

    public static func update(_ trip: Trip, url: URL? = nil, aborter: @escaping ((URL) -> Bool) = { _ in false }) -> Single<Bool>

Available where Base : TKRouter

  • Undocumented

    Declaration

    Swift

    public static func fetchBestTrip<C>(for request: TripRequest, modes: C) -> Single<Trip> where C : Collection, C.Element == String

Available where Base: TKRegionManager

  • Undocumented

    Declaration

    Swift

    public func requireRegion(_ coordinate: CLLocationCoordinate2D) -> Single<TKRegion>
  • Undocumented

    Declaration

    Swift

    public func requireRegion(_ coordinateRegion: MKCoordinateRegion) -> Single<TKRegion>
  • Undocumented

    Declaration

    Swift

    public func requireRegions() -> Single<Void>

Available where Base: TKServer

  • Undocumented

    Declaration

    Swift

    public func hit(_ method: TKServer.HTTPMethod = .GET, url: URL, parameters: [String : Any]? = nil) -> Single<(Int, [String : Any], Data)>
  • Undocumented

    Declaration

    Swift

    public func hit<Model: Decodable>(
      _ type: Model.Type,
      _ method: TKServer.HTTPMethod = .GET,
      url: URL,
      parameters: [String: Any] = [:],
      decoderConfig: @escaping (JSONDecoder) -> Void = { _ in }
      ) -> Single<(Int, [String: Any], Model)>
  • Undocumented

    Declaration

    Swift

    public func hit(
      _ method: TKServer.HTTPMethod = .GET,
      path: String,
      parameters: [String: Any] = [:],
      headers: [String: String] = [:],
      region: TKRegion? = nil
      ) -> Single<(Int?, [String: Any], Data?)>
  • Undocumented

    Declaration

    Swift

    public func stream(
      _ method: TKServer.HTTPMethod = .GET,
      path: String,
      parameters: [String: Any] = [:],
      headers: [String: String] = [:],
      region: TKRegion? = nil,
      repeatHandler: ((Int?, Data?) -> TKServer.RepeatHandler?)? = nil
      ) -> Observable<(Int?, [String: Any], Data?)>
  • Hit a SkedGo endpoint, using a variety of options

    Declaration

    Swift

    public func hit<Model: Decodable>(
      _ type: Model.Type,
      _ method: TKServer.HTTPMethod = .GET,
      path: String,
      parameters: [String: Any] = [:],
      headers: [String: String] = [:],
      region: TKRegion? = nil
      ) -> Single<(Int?, [String: Any], Model)>

    Parameters

    method

    Duh

    path

    The endpoint, e.g., routing.json

    parameters

    The parameters which will either be send in the query (for GET) or as the JSON body (for POST and alike)

    headers

    Additional headers to add to the request

    region

    The region for which to hit a server. In most cases, you want to set this as not every SkedGo server has data for every region.

    Return Value

    An observable with the status code, headers and data from hitting the endpoint, all status and data will be the same as the last call to the repeatHandler.

  • Hit a SkedGo endpoint, using a variety of options

    Declaration

    Swift

    public func stream<Model: Decodable>(
      _ type: Model.Type,
      _ method: TKServer.HTTPMethod = .GET,
      path: String,
      parameters: [String: Any] = [:],
      headers: [String: String] = [:],
      region: TKRegion? = nil,
      repeatHandler: ((Int?, Model?) -> TKServer.RepeatHandler?)? = nil
      ) -> Observable<(Int?, [String: Any], Model?)>

    Parameters

    method

    Duh

    path

    The endpoint, e.g., routing.json

    parameters

    The parameters which will either be send in the query (for GET) or as the JSON body (for POST and alike)

    headers

    Additional headers to add to the request

    region

    The region for which to hit a server. In most cases, you want to set this as not every SkedGo server has data for every region.

    repeatHandler

    Implement and return a non-negative time interval from this handler to fire the Observable again, or nil to stop firing.

    Return Value

    An observable with the status code, headers and data from hitting the endpoint, all status and data will be the same as the last call to the repeatHandler. Note: This will be called on a background thread.

Available where Base == TKSettings

  • Undocumented

    Declaration

    Swift

    public static var hiddenModeIdentifiers: Observable<Set<String>> { get }

Available where Base == TKUITripMonitorManager

  • Undocumented

    Declaration

    Swift

    public var trip: Infallible<Trip?> { get }