HistoryRecording

public protocol HistoryRecording

Types that conform to this protocol record low-level details as the user goes through a trip for debugging purposes.

  • A closure to be called when history writing ends.

    Declaration

    Swift

    typealias HistoryFileWritingCompletionHandler = (_ historyFileURL: URL?) -> Void

    Parameters

    historyFileURL

    A URL to the file that contains history data. This argument is nil if no history data has been written because history recording has not yet begun. Use the startRecordingHistory() method to begin recording before attempting to write a history file.

  • historyDirectoryURL Default implementation

    Path to the directory where history file could be stored when stopRecordingHistory(writingFileWith:) is called.

    Setting nil disables history recording. Defaults to nil. Updating value from nil to non-nil value results in recreating the shared instance since nil guaranteed an invalid handler. Further updates have no effect. Saved history files can be then read using HistoryReader.

    Default Implementation

    Declaration

    Swift

    static var historyDirectoryURL: URL? { get set }
  • startRecordingHistory() Default implementation

    Starts recording history for debugging purposes.

    Postcondition

    Use the stopRecordingHistory(writingFileWith:) method to stop recording history and write the recorded history to a file.

    Default Implementation

    Declaration

    Swift

    static func startRecordingHistory()
  • startRecordingHistory() Default implementation

    Starts recording history for debugging purposes.

    Postcondition

    Use the stopRecordingHistory(writingFileWith:) method to stop recording history and write the recorded history to a file.

    Default Implementation

    Declaration

    Swift

    @available(*, deprecated, message: "Use corresponding static method instead.")
    func startRecordingHistory()
  • pushHistoryEvent(type:jsonData:) Default implementation

    Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Default Implementation

    Declaration

    Swift

    static func pushHistoryEvent(type: String, jsonData: Data?) throws

    Parameters

    type

    The event type in the events log for your custom event.

    jsonData

    The data value that contains a valid JSON to attach to the event.

  • pushHistoryEvent(type:jsonData:) Default implementation

    Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Default Implementation

    Declaration

    Swift

    @available(*, deprecated, message: "Use corresponding static method instead.")
    func pushHistoryEvent(type: String, jsonData: Data?) throws

    Parameters

    type

    The event type in the events log for your custom event.

    jsonData

    The data value that contains a valid JSON to attach to the event.

  • Stops recording history, asynchronously writing any recorded history to a file.

    Upon completion, the completion handler is called with the URL to a file in the directory specified by historyDirectoryURL. The file contains details about the passive location manager’s activity that may be useful to include when reporting an issue to Mapbox.

    Saved history files can be then read using HistoryReader.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Postcondition

    To write history incrementally without an interruption in history recording, use the startRecordingHistory() method immediately after this method. If you use the startRecordingHistory() method inside the completion handler of this method, history recording will be paused while the file is being prepared.

    Default Implementation

    Declaration

    Swift

    static func stopRecordingHistory(writingFileWith completionHandler: @escaping HistoryFileWritingCompletionHandler)

    Parameters

    completionHandler

    A closure to be executed when the history file is ready.

  • Stops recording history, asynchronously writing any recorded history to a file.

    Upon completion, the completion handler is called with the URL to a file in the directory specified by historyDirectoryURL. The file contains details about the passive location manager’s activity that may be useful to include when reporting an issue to Mapbox.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Postcondition

    To write history incrementally without an interruption in history recording, use the startRecordingHistory() method immediately after this method. If you use the startRecordingHistory() method inside the completion handler of this method, history recording will be paused while the file is being prepared.

    Default Implementation

    Declaration

    Swift

    @available(*, deprecated, message: "Use corresponding static method instead.")
    func stopRecordingHistory(writingFileWith completionHandler: @escaping HistoryFileWritingCompletionHandler)

    Parameters

    completionHandler

    A closure to be executed when the history file is ready.

  • Declaration

    Swift

    static func startRecordingHistoryImplementation()
  • Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Declaration

    Swift

    static func pushHistoryEvent<Value>(type: String, value: Value?, encoder: JSONEncoder? = nil) throws where Value : Encodable

    Parameters

    type

    The event type in the events log for your custom event.

    value

    The value that implements Encodable protocol and can be encoded into a valid JSON to attach to the event.

    encoder

    The instance of JSONEncoder to be used for the value encoding. If this argument is omitted, the default JSONEncoder will be used.

  • Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Declaration

    Swift

    @available(*, deprecated, message: "Use corresponding static method instead.")
    func pushHistoryEvent<Value>(type: String, value: Value?, encoder: JSONEncoder? = nil) throws where Value : Encodable

    Parameters

    type

    The event type in the events log for your custom event.

    value

    The value that implements Encodable protocol and can be encoded into a valid JSON to attach to the event.

    encoder

    The instance of JSONEncoder to be used for the value encoding. If this argument is omitted, the default JSONEncoder will be used.

  • Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Declaration

    Swift

    static func pushHistoryEvent(type: String, dictionary value: [String : Any?]?) throws

    Parameters

    type

    The event type in the events log for your custom event.

    value

    The value disctionary that can be encoded into a JSON to attach to the event.

  • Appends a custom event to the current history log. This can be useful to log things that happen during navigation that are specific to your application.

    Precondition

    Use the startRecordingHistory() method to begin recording history. If the startRecordingHistory() method has not been called, this method has no effect.

    Declaration

    Swift

    @available(*, deprecated, message: "Use corresponding static method instead.")
    func pushHistoryEvent(type: String, dictionary value: [String : Any?]?) throws

    Parameters

    type

    The event type in the events log for your custom event.

    value

    The value disctionary that can be encoded into a JSON to attach to the event.