ListenerGroup
public class ListenerGroup
A class that provides a set of helper functions that enables a caller to wait for a group of listener blocks to finish executing.
Usage Example:
//Wait for all of the listeners to stop.
ListenerGroup.waitForListeners()
//Enqueue a block of code on a given queue, assigning it to the listener group in the process (so we can wait on it later).
ListenerGroup.enqueueAsynchronously(on: DispatchQueue.global(), block: queuedBlock)
-
Wait for all of the listeners to stop
Usage Example:
ListenerGroup.waitForListeners()
Declaration
Swift
public static func waitForListeners()
-
Enqueue a block of code on a given queue, assigning it to the listener group in the process (so we can wait on it later).
Usage Example:
ListenerGroup.enqueueAsynchronously(on: DispatchQueue.global(), block: queuedBlock)
Declaration
Swift
public static func enqueueAsynchronously(on queue: DispatchQueue, block: DispatchWorkItem)
Parameters
on
The queue on to which the provided block will be enqueued for asynchronous execution.
block
The block to be enqueued for asynchronous execution.