Dispatch

public struct Dispatch

Represents a tracking event or view to be dispatched.

  • The payload data of the dispatch.

    Declaration

    Swift

    public internal(set) var payload: DataObject { get }
  • id

    The unique identifier of the dispatch.

    Declaration

    Swift

    public let id: String
  • The timestamp of when the dispatch was created, in Unix milliseconds.

    Declaration

    Swift

    public let timestamp: Int64
  • Creates a new dispatch with the specified parameters.

    Declaration

    Swift

    public init(name: String, type: DispatchType = .event, data: DataObject? = nil)

    Parameters

    name

    The name of the event or view.

    type

    The type of dispatch (event or view).

    data

    Optional additional data to include.

  • The name of this dispatch.

    Declaration

    Swift

    public var name: String? { get }
  • Enriches the dispatch with additional data.

    Declaration

    Swift

    public mutating func enrich(data: DataObject)
  • Replaces the current payload with a new one.

    Declaration

    Swift

    public mutating func replace(payload: DataObject)
  • Returns a short description suitable for logging.

    Declaration

    Swift

    public func logDescription() -> String

    Return Value

    A string containing the dispatch ID prefix and name.

  • Extracts command(s) from the dispatch payload.

    Supports both single command (String) and array of commands ([String]). Commands are mapped to the “command_name” key by Mappings (not tealium_event). Duplicate commands are removed, keeping the first occurrence and preserving the order. Two commands are duplicates if they are equal once trimmed of whitespace and lowercased, which is how commands are matched when executed. Duplicates are removed only from the returned list: the payload’s “command_name” is left unchanged, so commands reading it directly may see duplicates.

    Declaration

    Swift

    func getCommands() -> [String]

    Return Value

    Array of unique command strings. Returns empty array if no commands found.