---
title: "replaceValue(at:inPropertyWithKey:withValue:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/replacevalue(at:inpropertywithkey:withvalue:)"
---

# replaceValue(at:inPropertyWithKey:withValue:)

Replaces the object at the specified index in the collection specified by the passed key.

## Declaration

```swift
func replaceValue(at index: Int, inPropertyWithKey key: String, withValue value: Any)
```

## Discussion

Discussion The method replaceIn<Key>:atIndex: is invoked if it exists. If no corresponding scripting-KVC-compliant method (-replaceIn<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

- [insertValue(_:at:inPropertyWithKey:)](objectivec/nsobject-swift.class/insertvalue(_:at:inpropertywithkey:).md)
- [removeValue(at:fromPropertyWithKey:)](objectivec/nsobject-swift.class/removevalue(at:frompropertywithkey:).md)
- [value(at:inPropertyWithKey:)](objectivec/nsobject-swift.class/value(at:inpropertywithkey:).md)
