---
title: "insertValue(_:at:inPropertyWithKey:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/insertvalue(_:at:inpropertywithkey:)"
---

# insertValue(_:at:inPropertyWithKey:)

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

## Declaration

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

## Discussion

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:.

## See Also

### Indexed access

- [removeValue(at:fromPropertyWithKey:)](objectivec/nsobject-swift.class/removevalue(at:frompropertywithkey:).md)
- [replaceValue(at:inPropertyWithKey:withValue:)](objectivec/nsobject-swift.class/replacevalue(at:inpropertywithkey:withvalue:).md)
- [value(at:inPropertyWithKey:)](objectivec/nsobject-swift.class/value(at:inpropertywithkey:).md)
