PHPhotoLibrary
An object that manages access and changes to the user’s photo library.
Declaration
class PHPhotoLibraryMentioned in
Overview
The object represents the entire set of assets and collections that the Photos app manages, including assets stored on the local device and those stored in iCloud Photos. Use this object for the following tasks:
Retrieving or verifying the user’s permission for your app to access Photos content
Making changes to assets and collections; for example, editing asset metadata or content, inserting new assets, or rearranging the members of a collection
Determining which records change since a previous state of the Photos library
Registering for update messages the system sends when the library changes
Topics
Verifying Authorization
authorizationStatus(for:)requestAuthorization(for:handler:)PHAccessLevelPHAuthorizationStatusauthorizationStatus()requestAuthorization(_:)
Accessing the Shared Library
Presenting the Limited Library Picker
Updating the Library
Requesting Changes to the Photo LibraryperformChanges(_:completionHandler:)performChangesAndWait(_:)PHChangeRequestPHAssetChangeRequestPHAssetCollectionChangeRequestPHCollectionListChangeRequestPHObjectPlaceholder
Fetching Change History
fetchPersistentChanges(since:)PHPersistentChangeFetchResultcurrentChangeTokenPHPersistentChangeToken
Observing Library Changes
Observing Changes in the Photo Libraryregister(_:)unregisterChangeObserver(_:)PHPhotoLibraryChangeObserverPHChangePHObjectChangeDetailsPHFetchResultChangeDetails
Observing Library Availability
register(_:)unregisterAvailabilityObserver(_:)PHPhotoLibraryAvailabilityObserverunavailabilityReason
Converting Between Local and iCloud Identifiers
cloudIdentifierMappings(forLocalIdentifiers:)localIdentifierMappings(for:)PHCloudIdentifiercloudIdentifiers(forLocalIdentifiers:)localIdentifiers(for:)PHLocalIdentifierNotFound