Instance Method


Removes the assets at the specified indexes from the asset collection.


func removeAssets(at indexes: IndexSet)



The indexes of the assets to be removed from the asset collection.


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 removing assets. To remove objects based on their identities (without regard to their indexes in the collection), use the removeAssets(_:) method.

See Also

Modifying Asset Collections

init?(for: PHAssetCollection)

Creates a request for modifying the specified asset collection.

init?(for: PHAssetCollection, assets: PHFetchResult<PHAsset>)

Creates a request for modifying the specified asset collection, with a fetch result for tracking changes.

var title: String

The displayed name of the asset collection.

func addAssets(NSFastEnumeration)

Add the specified assets to the asset collection.

func insertAssets(NSFastEnumeration, at: IndexSet)

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

func removeAssets(NSFastEnumeration)

Removes the specified assets from the asset collection.

func replaceAssets(at: IndexSet, withAssets: NSFastEnumeration)

Replaces the assets at the specified indexes in the asset collection with the specified assets.

func moveAssets(at: IndexSet, to: Int)

Moves the assets at the specified indexes in the asset collection to a new index.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software