MapRecorder

@_spi(Experimental)
public final class MapRecorder

MapboxRecorder provides functions to record and replay API calls of a MapboxMap instance. These recordings can be used to debug issues which require multiple steps to reproduce. Additionally, playbacks can be used for performance testing custom scenarios.

Note

The file format produced by MapRecorder is experimental and there is no guarantee for version cross-compatibility. The set of recorded APIs and their parameters might change in future releases.
  • Begins the recording session.

    Declaration

    Swift

    public func start(options: MapRecorderOptions = MapRecorderOptions(timeWindow: nil, loggingEnabled: false, compressed: false))

    Parameters

    options

    MapRecorderOptions to control recording. Optional.

  • Stops the current recording session. Recorded section can be replayed with replay() function. Returns the Data containing the recorded sequence in raw format.

    Declaration

    Swift

    public func stop() -> Data
  • Replay a supplied sequence from a map recording

    Declaration

    Swift

    public func replay(
        recordedSequence: Data,
        options: MapPlayerOptions = MapPlayerOptions(playbackCount: 1, playbackSpeedMultiplier: 1.0, avoidPlaybackPauses: false),
        completion: @escaping () -> Void
    )

    Parameters

    recordedSequence

    A data reference which should contain a re-playable sequence as a gzip compressed or plain JSON string. This is the recorded content captured in the return of stop()

    options

    Options to customize the behavior of the playback, see MapPlayerOptions. Optional.

    completion

    Completion handler be called when replay finishes

  • Temporarily pauses or resumes playback if already paused.

    Declaration

    Swift

    public func togglePauseReplay()
  • Returns the string description of the current state of playback.

    Declaration

    Swift

    public func playbackState() -> String