---
title: "addOperation(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/operationqueue/addoperation(_:)-5s294"
---

# addOperation(_:)

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

## Declaration

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

## Parameters

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

## Discussion

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

### Related Documentation

- [cancel()](foundation/operation/cancel().md)
- [isExecuting](foundation/operation/isexecuting.md)

### Managing Operations in the Queue

- [addOperation(_:)](foundation/operationqueue/addoperation(_:)-64o8a.md)
- [addOperations(_:waitUntilFinished:)](foundation/operationqueue/addoperations(_:waituntilfinished:).md)
- [addBarrierBlock(_:)](foundation/operationqueue/addbarrierblock(_:).md)
- [cancelAllOperations()](foundation/operationqueue/cancelalloperations().md)
- [waitUntilAllOperationsAreFinished()](foundation/operationqueue/waituntilalloperationsarefinished().md)
- [operations](foundation/operationqueue/operations.md)
- [operationCount](foundation/operationqueue/operationcount.md)
