Trip

Objective-C

@interface Trip : NSManagedObject {
}

+ (nullable Trip *)findSimilarTripTo:(nonnull Trip *)trip
                              inList:(nonnull id<NSFastEnumeration>)trips;

#pragma mark - Trip properties

@property (nonatomic, readonly, nonnull) TripRequest *request;

@property (nonatomic, strong, nullable) NSURL *shareURL;

@property (nonatomic, strong, nullable, readonly) NSURL *saveURL;

/**
 Checks if trip is in a usable state for CoreData. Bit of an ugly check to use
 in rare cases before accessing nonnull fields on a Trip object that might have
 seen disappeared from CoreData (and would then crash when using from Swift).
 */
@property (nonatomic, readonly) BOOL isValid;

- (void)setAsPreferredTrip;

@property (nonatomic, assign) BOOL showNoVehicleUUIDAsLift;

@property (nonatomic, assign) BOOL departureTimeIsFixed;

@property (nonatomic, assign) BOOL hasReminder;

@property (nonatomic, assign) BOOL missedBookingWindow;

@property (nonatomic, assign) BOOL isCanceled;

/**
 @note Only includes walking if it's a walking-only trip!
 @return Set of used mode identifiers.
 */
- (nonnull NSSet<NSString *> *)usedModeIdentifiers;

@property (readonly) BOOL allowImpossibleSegments;

/* Offset in minutes from the specified departure/arrival time.
 * E.g., if you asked for arrive-by, it'll use the arrival time.
 *
 * If the trip does not satisfy the requested time, it's negative.
 */
- (NSTimeInterval)calculateOffset;

/* Trip duration, i.e., time between departure and arrival. 
 */
- (nonnull NSNumber *)calculateDuration;

- (nonnull NSString *)constructPlainText;

- (nonnull NSDictionary<NSNumber *, NSString *> *)accessibleCostValues;

- (nonnull NSString *)debugString;

#pragma mark - Segment accessors

/* Returns all associated segment in their correct order.
 */
@property (nonnull, readonly) NSArray<TKSegment *> *segments;

/* The first major segment of the trip, according to segment properties (use mainSegment() instead)
 */
- (nullable TKSegment *)inferMainSegment;

/* Call this before changing the segments of a trip.
 */
- (void)clearSegmentCaches;

/* The first public transport segment of the trip
 */
@property (readonly, nullable) TKSegment *firstPublicTransport;

/* All public transport segments of the trip
 */
@property (nonnull, readonly) NSArray<TKSegment *> *allPublicTransport;

#pragma mark - Visualising trips on the map

- (BOOL)usesVisit:(nonnull StopVisits *)visit;

- (BOOL)shouldShowVisit:(nonnull StopVisits *)visit;

#pragma mark - Real-time stuff

@property (readonly) BOOL isImpossible;

@property (readonly) BOOL timesAreRealTime;

@property (nullable, readonly) Alert *primaryAlert;

@end
extension Trip: TKTrip
extension Trip: UIActivityItemSource
extension Trip: TKURLShareable, TKURLSavable

Swift

class Trip : NSManagedObject

Undocumented

  • Undocumented

    Declaration

    Objective-C

    + (nullable Trip *)findSimilarTripTo:(nonnull Trip *)trip
                                  inList:(nonnull id<NSFastEnumeration>)trips;

    Swift

    class func findSimilarTrip(to trip: Trip, inList trips: NSFastEnumeration) -> Trip?

Trip properties

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) TripRequest *request

    Swift

    var request: TripRequest { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSURL *shareURL

    Swift

    var shareURL: URL? { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable, readonly) NSURL *saveURL

    Swift

    var saveURL: URL? { get }
  • Checks if trip is in a usable state for CoreData. Bit of an ugly check to use in rare cases before accessing nonnull fields on a Trip object that might have seen disappeared from CoreData (and would then crash when using from Swift).

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isValid;

    Swift

    var isValid: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    - (void)setAsPreferredTrip;

    Swift

    func setAsPreferredTrip()
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) BOOL showNoVehicleUUIDAsLift

    Swift

    var showNoVehicleUUIDAsLift: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) BOOL departureTimeIsFixed

    Swift

    var departureTimeIsFixed: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) BOOL hasReminder

    Swift

    var hasReminder: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) BOOL missedBookingWindow

    Swift

    var missedBookingWindow: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) BOOL isCanceled

    Swift

    var isCanceled: Bool { get set }
  • Note

    Only includes walking if it’s a walking-only trip!

    Declaration

    Objective-C

    - (nonnull NSSet<NSString *> *)usedModeIdentifiers;

    Swift

    func usedModeIdentifiers() -> Set<String>

    Return Value

    Set of used mode identifiers.

  • Undocumented

    Declaration

    Objective-C

    @property (readonly) BOOL allowImpossibleSegments

    Swift

    var allowImpossibleSegments: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    - (NSTimeInterval)calculateOffset;

    Swift

    func calculateOffset() -> TimeInterval
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSNumber *)calculateDuration;

    Swift

    func calculateDuration() -> NSNumber
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSString *)constructPlainText;

    Swift

    func constructPlainText() -> String
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSDictionary<NSNumber *, NSString *> *)accessibleCostValues;

    Swift

    func accessibleCostValues() -> [NSNumber : String]
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSString *)debugString;

    Swift

    func debugString() -> String

Segment accessors

Visualising trips on the map

Real-time stuff

  • Undocumented

    Declaration

    Objective-C

    @property (readonly) BOOL isImpossible

    Swift

    var isImpossible: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    @property (readonly) BOOL timesAreRealTime

    Swift

    var timesAreRealTime: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, readonly) Alert *primaryAlert

    Swift

    var primaryAlert: Alert? { get }
  • Declaration

    Swift

    @nonobjc
    public class func fetchRequest() -> NSFetchRequest<Trip>
  • Declaration

    Swift

    @NSManaged
    public var arrivalTime: Date { get set }
  • Declaration

    Swift

    @NSManaged
    public var budgetPoints: NSNumber? { get set }
  • Declaration

    Swift

    @NSManaged
    public var currencyCode: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var departureTime: Date { get set }
  • Declaration

    Swift

    @NSManaged
    public var logURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var mainSegmentHashCode: Int32 { get set }
  • Declaration

    Swift

    @NSManaged
    public var minutes: Int16 { get set }
  • Declaration

    Swift

    @NSManaged
    public var plannedURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var progressURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var saveURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var shareURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var temporaryURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalCalories: Float { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalCarbon: Float { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalHassle: Float { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalPrice: NSNumber? { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalPriceUSD: NSNumber? { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalScore: Float { get set }
  • Declaration

    Swift

    @NSManaged
    public var totalWalking: Float { get set }
  • Declaration

    Swift

    @NSManaged
    public var updateURLString: String? { get set }
  • Declaration

    Swift

    @NSManaged
    public var representedGroup: TripGroup? { get set }
  • Declaration

    Swift

    @NSManaged
    public var tripGroup: TripGroup { get set }

Generated accessors for segmentReferences

  • Declaration

    Swift

    @objc(addSegmentReferencesObject:)
    @NSManaged
    public func addToSegmentReferences(_ value: SegmentReference)
  • Declaration

    Swift

    @objc(removeSegmentReferencesObject:)
    @NSManaged
    public func removeFromSegmentReferences(_ value: SegmentReference)
  • Declaration

    Swift

    @objc(addSegmentReferences:)
    @NSManaged
    public func addToSegmentReferences(_ values: NSSet)
  • Declaration

    Swift

    @objc(removeSegmentReferences:)
    @NSManaged
    public func removeFromSegmentReferences(_ values: NSSet)
  • Declaration

    Swift

    @objc
    public var bundleId: String? { get set }
  • Declaration

    Swift

    @objc
    public var primaryCostType: TKTripCostType { get }
  • Checks for intermodality. Ignores very short walks and, optionally, all walks.

    Declaration

    Swift

    @objc(isMixedModalIgnoringWalking:)
    public func isMixedModal(ignoreWalking: Bool) -> Bool

    Parameters

    ignoreWalking

    If walks should be ignored completely

    Return Value

    If trip is mixed modal (aka intermodmal)

Vehicles

  • If the trip uses a personal vehicle (non shared) which the user might want to assign to one of their vehicles

    Declaration

    Swift

    @objc
    public var usedPrivateVehicleType: TKVehicleType { get }
  • Segments of this trip which do use a private (or shared) vehicle, i.e., those who return something from usedVehicle.

    Declaration

    Swift

    @objc
    public var vehicleSegments: Set<TKSegment> { get }
  • Declaration

    Swift

    @objc
    public func assignVehicle(_ vehicle: TKVehicular?)

    Parameters

    vehicle

    The vehicle to assign this trip to. nil to reset to a generic vehicle.

TKTrip

UIActivityItemSource