---
title: "addOperations(_:waitUntilFinished:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/operationqueue/addoperations(_:waituntilfinished:)"
---

# addOperations(_:waitUntilFinished:)

Adds the specified operations to the queue.

## Declaration

```swift
func addOperations(_ ops: [Operation], waitUntilFinished wait: Bool)
```

## Parameters

- `ops`: The operations to be added to the queue.
- `wait`: If doc://com.apple.documentation/documentation/Swift/true, the current thread is blocked until all of the specified operations finish executing. If doc://com.apple.documentation/documentation/Swift/false, the operations are added to the queue and control returns immediately to the caller.

## Discussion

Discussion An operation object can be in at most one operation queue at a time and cannot be added if it is currently executing or finished. This method throws an NSInvalidArgumentException exception if any of those error conditions are true for any of the operations in the ops parameter. Once added, the specified operation remains in the queue until its isFinished method returns true.

## See Also

### Managing Operations in the Queue

- [addOperation(_:)](foundation/operationqueue/addoperation(_:)-64o8a.md)
- [addOperation(_:)](foundation/operationqueue/addoperation(_:)-5s294.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)
