TealiumInstanceManager

public class TealiumInstanceManager

A class that creates and stores all the created Tealium instances and reuse all of its dependencies when a new instance is created with the same account and profile.

All references to created Tealium instances are kept weak so that an app that removes all their references to a Tealium instance will automatically deallocate that instance.

  • The shared TealiumInstanceManager object.

    Declaration

    Swift

    public static let shared: TealiumInstanceManager
  • Creates a new Tealium instance based on the provided config.

    Typical usage in an app would be to keep a reference of the returned instance to keep it alive for as long as the app is alive. However, the returned Tealium should be shutdown by the user when no longer required by removing all strong references to the returned instance.

    If you don’t hold a strong reference to the returned instance, it will immediately shut down.

    Declaration

    Swift

    public func create(config: TealiumConfig, completion: ((InitializationResult<Tealium>) -> Void)? = nil) -> Tealium

    Parameters

    config

    The required configuration options for this instance.

    completion

    The callback allows the caller to be notified once the instance is ready, or has failed during initialization alongside the cause of the failure.

    Return Value

    The Tealium instance ready to accept input, although if the initialization fails, any method calls made to this object will also fail.

  • Retrieves an existing Tealium instance, if one has already been created using its TealiumConfig.key and is still alive.

    Declaration

    Swift

    public func get(_ config: TealiumConfig, completion: @escaping (Tealium?) -> Void)

    Parameters

    config

    The config that was used to create the instance.

    completion

    The block to receive the Tealium instance on, if found.

  • Retrieves an existing Tealium instance, if one has already been created using its TealiumConfig.key and is still alive.

    Declaration

    Swift

    public func get(_ key: String, completion: @escaping (Tealium?) -> Void)

    Parameters

    key

    The key that identifies the Tealium instance.

    completion

    The block to receive the Tealium instance on, if found.