<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.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/NSPointerArray/replacePointer(at:withPointer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPointerArray(im)replacePointerAtIndex:withPointer:"
  },
  "title" : "replacePointer(at:withPointer:)"
}
-->

# replacePointer(at:withPointer:)

Replaces the pointer at a given index.

```
func replacePointer(at index: Int, withPointer item: UnsafeMutableRawPointer?)
```

## Parameters

`index`

The index of an element in the receiver. This value must be less than the [`count`](/documentation/Foundation/NSPointerArray/count) of the receiver.

`item`

The item with which to replace the element at `index`. This value may be `NULL`.

## Discussion

---

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)