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?) -> VoidParameters
historyFileURLA URL to the file that contains history data. This argument is
nilif no history data has been written because history recording has not yet begun. Use thestartRecordingHistory()method to begin recording before attempting to write a history file. -
historyDirectoryURLDefault implementationPath to the directory where history file could be stored when
stopRecordingHistory(writingFileWith:)is called.Setting
nildisables history recording. Defaults tonil. Updating value fromniltonon-nilvalue results in recreating the shared instance sincenilguaranteed an invalid handler. Further updates have no effect. Saved history files can be then read usingHistoryReader.Default Implementation
Declaration
Swift
static var historyDirectoryURL: URL? { get set } -
startRecordingHistory()Default implementationStarts recording history for debugging purposes.
Postcondition
Use thestopRecordingHistory(writingFileWith:)method to stop recording history and write the recorded history to a file.Default Implementation
Declaration
Swift
static func startRecordingHistory() -
startRecordingHistory()Default implementationStarts recording history for debugging purposes.
Postcondition
Use thestopRecordingHistory(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 implementationAppends 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 thestartRecordingHistory()method has not been called, this method has no effect.Default Implementation
Declaration
Swift
static func pushHistoryEvent(type: String, jsonData: Data?) throwsParameters
typeThe event type in the events log for your custom event.
jsonDataThe data value that contains a valid JSON to attach to the event.
-
pushHistoryEvent(type:jsonData:)Default implementationAppends 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 thestartRecordingHistory()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?) throwsParameters
typeThe event type in the events log for your custom event.
jsonDataThe data value that contains a valid JSON to attach to the event.
-
stopRecordingHistory(writingFileWith:)Default implementationStops 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 thestartRecordingHistory()method to begin recording history. If thestartRecordingHistory()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 thestartRecordingHistory()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
completionHandlerA closure to be executed when the history file is ready.
-
stopRecordingHistory(writingFileWith:)Default implementationStops 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 thestartRecordingHistory()method to begin recording history. If thestartRecordingHistory()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 thestartRecordingHistory()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
completionHandlerA closure to be executed when the history file is ready.
-
startRecordingHistoryImplementation()Extension methodDeclaration
Swift
static func startRecordingHistoryImplementation() -
pushHistoryEvent(type:value:encoder:)Extension methodAppends 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 thestartRecordingHistory()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 : EncodableParameters
typeThe event type in the events log for your custom event.
valueThe value that implements
Encodableprotocol and can be encoded into a valid JSON to attach to the event.encoderThe instance of
JSONEncoderto be used for the value encoding. If this argument is omitted, the defaultJSONEncoderwill be used. -
pushHistoryEvent(type:value:encoder:)Extension methodAppends 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 thestartRecordingHistory()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 : EncodableParameters
typeThe event type in the events log for your custom event.
valueThe value that implements
Encodableprotocol and can be encoded into a valid JSON to attach to the event.encoderThe instance of
JSONEncoderto be used for the value encoding. If this argument is omitted, the defaultJSONEncoderwill be used. -
pushHistoryEvent(type:dictionary:)Extension methodAppends 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 thestartRecordingHistory()method has not been called, this method has no effect.Declaration
Swift
static func pushHistoryEvent(type: String, dictionary value: [String : Any?]?) throwsParameters
typeThe event type in the events log for your custom event.
valueThe value disctionary that can be encoded into a JSON to attach to the event.
-
pushHistoryEvent(type:dictionary:)Extension methodAppends 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 thestartRecordingHistory()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?]?) throwsParameters
typeThe event type in the events log for your custom event.
valueThe value disctionary that can be encoded into a JSON to attach to the event.
Install in Dash
HistoryRecording Protocol Reference