TKUITripMonitorManager

@available(iOS 14.0, *)
@MainActor
public class TKUITripMonitorManager : NSObject, ObservableObject

The manager for trip notifications such as “get off at the next stop” or “your trip is about to start”

Requirements:

  • Project > Your Target > Capabilities > Background Modes: Enable “Location Updates”
  • Project > Your Target > Info: Include both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription
  • Then call TKUINotificationManager.shared.subscribe(to: .tripAlerts) { ... } in your app.
  • Implement TKUINotificationManagerDelegate and set it on TKUINotificationManager.shared.delegate

Push notifications:

An additional feature is server-side notifications related to a trip being monitored. This requires additional set-up:

  • Lastly, call TKUINotificationManager.shared.subscribe(to: .pushNotifications) { _ in }
  • Will be set on UNNotificationRequest.content.categoryIdentifier

    These notifications will also get UNNotificationRequest.identifier set to TKAPI.TripNotification.id

    Declaration

    Swift

    nonisolated public static let tripNotificationCategoryIdentifier: String
  • Undocumented

    Declaration

    Swift

    @objc(sharedInstance)
    public static let shared: TKUITripMonitorManager
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func monitorRegions(from trip: Trip, includeTimeToLeaveNotification: Bool = true) async throws
  • stopMonitoring() Asynchronous

    Undocumented

    Declaration

    Swift

    public func stopMonitoring() async
  • Undocumented

    See more

    Declaration

    Swift

    public struct GeofenceMatch
  • Undocumented

    Declaration

    Swift

    public func match(geofenceID: String) -> GeofenceMatch?