TealiumDispatchGroup
public class TealiumDispatchGroup
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.
-
Creates a new dispatch group with the specified queue.
Declaration
Swift
public init(queue: TealiumQueue)Parameters
queueThe queue on which to execute operations.
-
Executes multiple operations in parallel and collects their results.
Declaration
Swift
public func parallelExecution<Result>(_ works: [(@escaping (Result) -> Void) -> Void], completion: @escaping ([Result]) -> Void)Parameters
worksAn array of work items that take a completion handler.
completionCalled when all work items complete with their results.
View on GitHub