Instance Method


Makes the receiver dependent on the completion of the specified operation.


func addDependency(_ op: Operation)



The operation on which the receiver should depend. The same dependency should not be added more than once to the receiver, and the results of doing so are undefined.


The receiver is not considered ready to execute until all of its dependent operations have finished executing. If the receiver is already executing its task, adding dependencies has no practical effect. This method may change the isReady and dependencies properties of the receiver.

It is a programmer error to create any circular dependencies among a set of operations. Doing so can cause a deadlock among the operations and may freeze your program.

See Also

Managing Dependencies

func removeDependency(Operation)

Removes the receiver’s dependence on the specified operation.

var dependencies: [Operation]

An array of the operation objects that must finish executing before the current object can begin executing.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software