An ordered list of assets or collections returned from a Photos fetch method.
- iOS 8.0+
- macOS 10.13+Beta
- tvOS 10.0+
When you use class methods on the
PHCollectionList classes to retrieve objects, Photos provides the resulting objects in a fetch result. You access the contents of a fetch result with the same methods and conventions used by the
NSArray class. Unlike an
NSArray object, however, a
PHFetchResult object dynamically loads its contents from the Photos library as needed, providing optimal performance even when handling a large number of results.
A fetch result provides thread-safe access to its contents. After a fetch, the fetch result’s
count value is constant, and all objects in the fetch result keep the same
localIdentifier value. (To get updated content for a fetch, register a change observer with the shared
A fetch result caches its contents, keeping a batch of objects around the most recently accessed index. Because objects outside of the batch are no longer cached, accessing these objects results in refetching those objects. This process can result in changes to values previously read from those objects.
Finding Objects in a Fetch Result
func index(of: ObjectType)
Returns the lowest index whose corresponding object in the fetch result is equal to the specified object.
Performing Operations with Objects in a Fetch Result
Retrieving and Examining Assets
A representation of an image, video or Live Photo in the Photos library.
A representation of a Photos asset grouping, such as a moment, user-created album, or smart album.
A representation of a group containing Photos asset collections, such as a moments year or a folder of user-created albums.
The abstract superclass for Photos asset collections and collection lists.
The abstract superclass for Photos model objects (assets and collections).
A set of options that affect the filtering, sorting, and management of results that Photos returns when you fetch asset or collection objects.
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