<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAppleEventDescriptor/insert(_:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAppleEventDescriptor(im)insertDescriptor:atIndex:"
  },
  "title" : "insert(_:at:)"
}
-->

# insert(_:at:)

Inserts a descriptor at the specified (one-based) position in the receiving descriptor list, replacing the existing descriptor, if any, at that position.

```
func insert(_ descriptor: NSAppleEventDescriptor, at index: Int)
```

## Parameters

`descriptor`

The descriptor to insert in the receiver. Specifying an index of 0 or count + 1 causes appending to the end of the list.

`index`

The one-based descriptor list position at which to insert the descriptor.

## Discussion

Because it actually replaces the descriptor, if any, at the specified position, this method might better be called `replaceDescriptor:atIndex:`. The receiver must be a list descriptor. The indices are one-based. Currently provides no indication if an error occurs.

---

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)