<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/Photos/PHAssetCollectionChangeRequest/insertAssets(_:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Photos"
    ],
    "preciseIdentifier" : "c:objc(cs)PHAssetCollectionChangeRequest(im)insertAssets:atIndexes:"
  },
  "title" : "insertAssets(_:at:)"
}
-->

# insertAssets(_:at:)

Inserts the specified assets into the collection at the specified indexes.

```
func insertAssets(_ assets: any NSFastEnumeration, at indexes: IndexSet)
```

## Parameters

`assets`

An array of [`PHAsset`](/documentation/Photos/PHAsset) objects to be inserted into the asset collection.

`indexes`

The indexes at which the assets should be inserted. The count of locations in this index set must equal the count of assets.

## Discussion

To ensure that the index set you specify is valid even if the asset collection has changed since you fetched it, create a change request with a snapshot of the asset collection’s contents using the [`init(for:assets:)`](/documentation/Photos/PHAssetCollectionChangeRequest/init(for:assets:)) method before inserting assets.

For a detailed discussion of how the index set you specify maps to insertions in the list of assets, see the similar <doc://com.apple.documentation/documentation/Foundation/NSMutableArray> method <doc://com.apple.documentation/documentation/Foundation/NSMutableArray/insert(_:at:)-73pln>.

> Note:
> Assets from My Photo Stream or iCloud Shared Albums and assets synced to the device through iTunes cannot be added to collections. Transient asset collections (such as those created with the ``doc://com.apple.photokit/documentation/Photos/PHAssetCollection/transientAssetCollection(with:title:)`` method) do not support adding or removing content.

---

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)