DispatchQueue

extension DispatchQueue
  • Schedules a block asynchronously for execution in the main queue if not currently in the main queue otherwise the block executes immediately.

    Declaration

    Swift

    public static func mainAsyncIfNeeded(execute work: @escaping @convention(block) () -> Void)

    Parameters

    work

    The block containing the work to perform. This block has no return value and no parameters.