---
title: "exchangePage(at:withPageAt:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfdocument/exchangepage(at:withpageat:)"
---

# exchangePage(at:withPageAt:)

Swaps one page with another.

## Declaration

```swift
func exchangePage(at indexA: Int, withPageAt indexB: Int)
```

## Discussion

Discussion This method raises an exception if either index value is out of bounds.

## See Also

### Working with Pages

- [pageCount](pdfkit/pdfdocument/pagecount.md)
- [page(at:)](pdfkit/pdfdocument/page(at:).md)
- [index(for:)](pdfkit/pdfdocument/index(for:).md)
- [insert(_:at:)](pdfkit/pdfdocument/insert(_:at:).md)
- [removePage(at:)](pdfkit/pdfdocument/removepage(at:).md)
- [pageClass](pdfkit/pdfdocument/pageclass.md)
