---
title: "CFArrayExchangeValuesAtIndices(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfarrayexchangevaluesatindices(_:_:_:)"
---

# CFArrayExchangeValuesAtIndices(_:_:_:)

Exchanges the values at two indices of an array.

## Declaration

```swift
func CFArrayExchangeValuesAtIndices(_ theArray: CFMutableArray!, _ idx1: CFIndex, _ idx2: CFIndex)
```

## Parameters

- `theArray`: The array that contains the values to be swapped.
- `idx1`: The index of the value to swap with the value at idx2. The index must not exceed the index space of theArray (0 to N-1 inclusive, where N is the count of theArray before the operation).
- `idx2`: The index of the value to swap with the value at idx1. The index must not exceed the index space of theArray (0 to N-1 inclusive, where N is the count of theArray before the operation).

## See Also

### CFMutableArray Miscellaneous Functions

- [CFArrayAppendArray(_:_:_:)](corefoundation/cfarrayappendarray(_:_:_:).md)
- [CFArrayAppendValue(_:_:)](corefoundation/cfarrayappendvalue(_:_:).md)
- [CFArrayCreateMutable(_:_:_:)](corefoundation/cfarraycreatemutable(_:_:_:).md)
- [CFArrayCreateMutableCopy(_:_:_:)](corefoundation/cfarraycreatemutablecopy(_:_:_:).md)
- [CFArrayInsertValueAtIndex(_:_:_:)](corefoundation/cfarrayinsertvalueatindex(_:_:_:).md)
- [CFArrayRemoveAllValues(_:)](corefoundation/cfarrayremoveallvalues(_:).md)
- [CFArrayRemoveValueAtIndex(_:_:)](corefoundation/cfarrayremovevalueatindex(_:_:).md)
- [CFArrayReplaceValues(_:_:_:_:)](corefoundation/cfarrayreplacevalues(_:_:_:_:).md)
- [CFArraySetValueAtIndex(_:_:_:)](corefoundation/cfarraysetvalueatindex(_:_:_:).md)
- [CFArraySortValues(_:_:_:_:)](corefoundation/cfarraysortvalues(_:_:_:_:).md)
