insertAssets(_:at:)
Inserts the specified assets into the collection at the specified indexes.
Declaration
func insertAssets(_ assets: any NSFastEnumeration, at indexes: IndexSet)Parameters
- assets:
An array of 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:) 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:).