---
title: "insertAssets(_:at:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phassetcollectionchangerequest/insertassets(_:at:)"
---

# insertAssets(_:at:)

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

## Declaration

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

## Parameters

- `assets`: An array of doc://com.apple.photokit/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

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:) 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 NSMutableArray method insert(_:at:). 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 transientAssetCollection(with:title:) method) do not support adding or removing content.

## See Also

### Modifying Asset Collections

- [init(for:)](photos/phassetcollectionchangerequest/init(for:).md)
- [init(for:assets:)](photos/phassetcollectionchangerequest/init(for:assets:).md)
- [title](photos/phassetcollectionchangerequest/title.md)
- [addAssets(_:)](photos/phassetcollectionchangerequest/addassets(_:).md)
- [removeAssets(_:)](photos/phassetcollectionchangerequest/removeassets(_:).md)
- [removeAssets(at:)](photos/phassetcollectionchangerequest/removeassets(at:).md)
- [replaceAssets(at:withAssets:)](photos/phassetcollectionchangerequest/replaceassets(at:withassets:).md)
- [moveAssets(at:to:)](photos/phassetcollectionchangerequest/moveassets(at:to:).md)
