---
title: "replacePointer(at:withPointer:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nspointerarray/replacepointer(at:withpointer:)"
---

# replacePointer(at:withPointer:)

Replaces the pointer at a given index.

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/NSPointerArray/count of the receiver.
- `item`: The item with which to replace the element at index. This value may be NULL.

## See Also

### Managing the Collection

- [count](foundation/nspointerarray/count.md)
- [allObjects](foundation/nspointerarray/allobjects.md)
- [pointer(at:)](foundation/nspointerarray/pointer(at:).md)
- [addPointer(_:)](foundation/nspointerarray/addpointer(_:).md)
- [removePointer(at:)](foundation/nspointerarray/removepointer(at:).md)
- [insertPointer(_:at:)](foundation/nspointerarray/insertpointer(_:at:).md)
- [compact()](foundation/nspointerarray/compact().md)
