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

# addOperation(_:)

Adds the specified operation to the receiver.

```
func addOperation(_ op: Operation)
```

## Parameters

`op`

The operation to be added to the queue.

## Discussion

Once added, the specified operation remains in the queue until it finishes executing.

> Important:
> An operation object can be in at most one operation queue at a time and this method throws an ``doc://com.apple.foundation/documentation/Foundation/NSExceptionName/invalidArgumentException`` exception if the operation is already in another queue. Similarly, this method throws an ``doc://com.apple.foundation/documentation/Foundation/NSExceptionName/invalidArgumentException`` exception if the operation is currently executing or has already finished executing.

## See Also

[`cancel()`](/documentation/Foundation/Operation/cancel())

Advises the operation object that it should stop executing its task.

[`isExecuting`](/documentation/Foundation/Operation/isExecuting)

A Boolean value indicating whether the operation is currently executing.



---

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)