TealiumSignposter Class Reference
public class TealiumSignposter
A wrapper around the OSSignposter API to make it easier to use when supporting iOS < 15. Enable it by changing the enabled static flag on this class.
On iOS < 15 this class does nothing.
For normal usecases of intervals being signposted you can use the TealiumSignpostInterval instead of this class, so you can avoid handling the SignpostStateWrapper yourself.
If instead you want to handle it yourself, or you have to send singular events, you can use this class like so:
let signposter = TealiumSignposter("Networking")
let state = signposter.beginInterval("Start Request", "\(request)")
urlSession.dataTask(request) { _, response, _ in
signposter.endInterval("Start Request", state: state, "\(response)")
// Handle the HTTP response
}
Note that the beginInterval name needs to match with the endInterval name.
-
Set this to true at the start of the app to make sure Signposting is enabled
Declaration
Swift
public static var enabled: Bool -
Creates and returns a
TealiumSignposterwith the given categoryDeclaration
Swift
public init(category: String) -
Begins a new interval with the given name on iOS 15+.
No-op on iOS < 15.
Declaration
Swift
public func beginInterval(_ name: StaticString) -> SignpostStateWrapper?Parameter Description namethe
StaticStringused to name this intervalReturn Value
an optional
SignpostStateWrapperused to pass it to theendIntervalmethod. Nil on iOS < 15 -
Begins a new interval with the given name on iOS 15+.
No-op on iOS < 15.
Declaration
Swift
public func beginInterval(_ name: StaticString, _ messageProvider: @autoclosure @escaping () -> String) -> SignpostStateWrapper?Parameter Description namethe
StaticStringused to name this intervalmessageProviderthe autoclosure
Stringused to describe some parameters for this begin intervalReturn Value
an optional
SignpostStateWrapperused to pass it to theendIntervalmethod. Nil on iOS < 15 -
Ends an interval previously created with the given name on iOS 15+.
No-op on iOS < 15.
Declaration
Swift
public func endInterval(_ name: StaticString, state: SignpostStateWrapper?)Parameter Description namethe
StaticStringused to name the interval. Must be an exact match with the begin interval callstatethe
SignpostStateWrapperreturned by the begin interval callReturn Value
an optional
SignpostStateWrapperused to pass it to theendIntervalmethod. Nil on iOS < 15 -
Ends an interval previously created with the given name on iOS 15+.
No-op on iOS < 15.
Declaration
Swift
public func endInterval(_ name: StaticString, state: SignpostStateWrapper?, _ messageProvider: @autoclosure @escaping () -> String)Parameter Description namethe
StaticStringused to name the interval. Must be an exact match with the begin interval callstatethe
SignpostStateWrapperreturned by the begin interval callmessageProviderthe autoclosure
Stringused to describe some parameters for this end interval callReturn Value
an optional
SignpostStateWrapperused to pass it to theendIntervalmethod. Nil on iOS < 15 -
Emits a single event on this signpost with the given name
Declaration
Swift
public func event(_ name: StaticString)Parameter Description namethe
StaticStringused to name the event -
Emits a single event on this signpost with the given name
Declaration
Swift
public func event(_ name: StaticString, _ messageProvider: @autoclosure @escaping () -> String)Parameter Description namethe
StaticStringused to name the eventmessageProviderthe autoclosure
Stringused to describe some parameters for this event call