Swift Class: TealiumInstanceManager

Swift Class: TealiumInstanceManager

by 2 weeks ago - edited 2 weeks ago (30 Views)

Purpose

Provides a method of accessing a previously-instantiated instance of Tealium, using the key format "account.profile.environment".

Supported Platforms

  • iOS
  • tvOS
  • watchOS
  • macOS

Installation

Included with the TealiumCore framework

CocoaPods

pod 'tealium-swift/TealiumCore'

import TealiumSwift

Carthage

TealiumCore.framework

import TealiumCore

Public API

getInstanceByName

Returns a Tealium instance for a specified account/profile/environment key.

getInstanceByName(instanceKey: String) -> Tealium?

Parameters Type Description
instanceKey String The name of the Tealium class instance to be retrieved (format: "(account).(profile).(environment)")
let instanceManager = TealiumInstanceManager.shared
let myTealiumInstance = instanceManager.getInstanceByName("tealiummobile.demo.dev")
// now call any methods on the Tealium instance you just retrieved
// myTealiumInstance?.track("myevent") // note: returns an optional

tealiumInstances

Property returning a dictionary of all registered Tealium instances.

let instanceManager = TealiumInstanceManager.shared
let allTealiumInstances = instanceManager.tealiumInstances
// do any required processing with the dictionary of valid Tealium instances

Change Log

1.6.5

  • Initial release