Instance Method

addOperation(_:)

Wraps the specified block in an operation and adds it to the receiver.

Declaration

func addOperation(_ block: @escaping () -> Void)

Parameters

block

The block to execute from the operation. The block takes no parameters and has no return value.

Discussion

This method adds a single block to the receiver by first wrapping it in an operation object. You should not attempt to get a reference to the newly created operation object or determine its type information.

See Also

Managing Operations in the Queue

func addOperation(Operation)

Adds the specified operation to the receiver.

func addOperations([Operation], waitUntilFinished: Bool)

Adds the specified operations to the queue.

var operations: [Operation]

The operations currently in the queue.

Deprecated
var operationCount: Int

The number of operations currently in the queue.

Deprecated
func cancelAllOperations()

Cancels all queued and executing operations.

func waitUntilAllOperationsAreFinished()

Blocks the current thread until all of the receiver’s queued and executing operations finish executing.