Other Classes

The following classes are available globally.

  • Listens for application lifecycle events and publishes status changes.

    See more

    Declaration

    Swift

    public class ApplicationStatusListener : NSObject
  • Safe implementation of a repeating timer for scheduling connectivity checks

    See more

    Declaration

    Swift

    public class RepeatingTimer : Repeater
  • A utility class that wraps a DispatchGroup and makes safer to use and includes an array of results in the completion.

    Differently from the DispatchGroup, if the first work completes synchronously the completion won’t be called until all the other work is completed too. All the results then are collected and returned in the completion.

    See more

    Declaration

    Swift

    public class TealiumDispatchGroup
  • A wrapper class around DispatchQueue to only dispatch asynchronously when we are on a different queue.

    Making it dispatch synchronously in a generic library would instead be not safe and could lead to deadlocks. An example of deadlock that would look safe is this:

     DispatchQueue.main.async {
         let queue = TealiumQueue(label: "something")
         queue.ensureOnQueue {
             print("This will print")
             DispatchQueue.main.sync { // This is something that a user might do on one of our completions
                 print("This will never print")
             }
         }
         queue.syncOnQueue { // This is something that might be part of our library if we do introduce a method like this
             print("This will never print")
         }
     }
    

    Therefore we only have, and only should have, an async method which is ensureOnQueue.

    See more

    Declaration

    Swift

    public class TealiumQueue
  • Utility to replace double brace wrapped text with values extracted from a DataObject.

    See more

    Declaration

    Swift

    public class TemplateProcessor