TealiumSignpostInterval

public class TealiumSignpostInterval

A convenience class to use the TealiumSignposter in an interval fashion that handles the SignpostStateWrapper internally.

This class will work correctly as long as you get exactly one end call after every begin. The suggested way to use this would be to create and begin a new interval everytime it’s needed and then end it once the interval is completed.

Usage:

 let signpostInterval = TealiumSignpostInterval(signposter: .networking, name: "HTTP Call Sent").begin("URL: \(request.url!)"
 session.dataTask(request) { _, response, _ in
    signpostInterval.end("Response \(response)")
    // handle request completion
 }
  • Creates and return a new TealiumSignposterInterval with the given category and name

    Declaration

    Swift

    public convenience init(category: String, name: StaticString)
  • Creates and return a new TealiumSignpostInterval with the given TealiumSignposter and name

    Declaration

    Swift

    public init(signposter: TealiumSignposter, name: StaticString)
  • Begins the interval

    No-op on iOS < 15.

    Declaration

    Swift

    public func begin() -> Self

    Return Value

    self for ease of use

  • Begins the interval.

    No-op on iOS < 15.

    Declaration

    Swift

    public func begin(_ messageProvider: @autoclosure @escaping () -> String) -> Self

    Parameters

    messageProvider

    the autoclosure String used to describe some parameters for this begin interval

    Return Value

    self for ease of use

  • Ends the previously created interval.

    No-op on iOS < 15.

    Declaration

    Swift

    public func end()
  • Ends an interval previously created with the given name on iOS 15+.

    No-op on iOS < 15.

    Declaration

    Swift

    public func end(_ messageProvider: @autoclosure @escaping () -> String)

    Parameters

    messageProvider

    the autoclosure String used to describe some parameters for this end interval call

  • Begins and ends a signpost interval around a synchronous block of code.

    Just runs the work on iOS < 15.

    Declaration

    Swift

    public func signpostedWork<Output>(_ work: () throws -> Output) rethrows -> Output

    Parameters

    work

    the block to be run while surrounded by the signpost interval

    Return Value

    the same Output of the block passed as parameter

  • Begins and ends a signpost interval around a synchronous block of code.

    Just runs the work on iOS < 15.

    Declaration

    Swift

    public func signpostedWork<Output>(_ messageProvider: @autoclosure @escaping () -> String, _ work: @escaping () throws -> Output) rethrows -> Output

    Parameters

    work

    the block to be run while surrounded by the signpost interval

    messageProvider

    the autoclosure String used to describe some parameters for the begin interval call

    Return Value

    the same Output of the block passed as parameter