<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/OperationQueue/addOperations(_:waitUntilFinished:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOperationQueue(im)addOperations:waitUntilFinished:"
  },
  "title" : "addOperations(_:waitUntilFinished:)"
}
-->

# addOperations(_:waitUntilFinished:)

Adds the specified operations to the queue.

```
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

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`](/documentation/Foundation/Operation/isFinished) method returns <doc://com.apple.documentation/documentation/Swift/true>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)