<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/insertValue(_:at:inPropertyWithKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime",
      "ObjectiveC"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)insertValue:atIndex:inPropertyWithKey:"
  },
  "title" : "insertValue(_:at:inPropertyWithKey:)"
}
-->

# insertValue(_:at:inPropertyWithKey:)

Inserts an object at the specified index in the collection specified by the passed key.

```
func insertValue(_ value: Any, at index: Int, inPropertyWithKey key: String)
```

## Discussion

The method `insertIn<Key>:atIndex:` is invoked if it exists. If no corresponding scripting-KVC-compliant method (`insertIn<Key>:atIndex:` ) is found, this method invokes `mutableArrayValueForKey:` and mutates the result.

> Note:
> Prior to OS X version 10.4, this method did not invoke `-mutableArrayValueForKey:`.

---

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)