Class

ALAssetsLibrary

An instance of ALAssetsLibrary provides access to the videos and photos that are under the control of the Photos application.

Overview

The library includes those that are in the Saved Photos album, those coming from iTunes, and those that were directly imported into the device. You use it to retrieve the list of all asset groups and to save images and videos into the Saved Photos album.

You create an instance of ALAssetsLibrary using alloc and init:

ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];

The lifetimes of objects you get back from a library instance are tied to the lifetime of the library instance.

Many of the methods declared by ALAssetsLibrary take blocks for failure and success as arguments. These methods are all asynchronous because the user may need to be asked to grant access to the data.

Symbols

Accessing Assets

class func authorizationStatus()

Returns photo data authorization status for this application.

Managing Notifications

class func disableSharedPhotoStreamsSupport()

Disables shared photo streams notifications and asset retrieval.

Finding Assets

func asset(for: URL!, resultBlock: ALAssetsLibraryAssetForURLResultBlock!, failureBlock: ALAssetsLibraryAccessFailureBlock!)

Invokes a given block passing as a parameter an asset identified by a specified file URL.

Enumerating Assets

func enumerateGroups(withTypes: ALAssetsGroupType, using: ALAssetsLibraryGroupsEnumerationResultsBlock!, failureBlock: ALAssetsLibraryAccessFailureBlock!)

Invokes a given block passing as a parameter each of the asset groups that match the given asset group type.

Constants

ALAssetsGroupType

A bitfield to identify types of asset.

Types of Asset

Constants to identify types of asset.

ALAssetOrientation

Constants to indicate the orientation of an asset.

ALAssetsLibraryGroupsEnumerationResultsBlock

Signature for the block executed when a match is found during enumeration using enumerateGroups(withTypes:using:failureBlock:).

ALAssetsLibraryAssetForURLResultBlock

Signature for the block executed if the user has granted access to the caller to access the data managed by the framework in asset(for:resultBlock:failureBlock:).

ALAssetsLibraryAccessFailureBlock

Signature for the block executed if the user does not grant access to the caller to access the data managed by the framework.

ALAssetsLibraryGroupResultBlock

Signature for the block executed if the user grants access to the caller to access the data managed by the framework..

ALAuthorizationStatus

Constants to indicate authorization status.

Notification Keys

Keys used to get values from the user information dictionary of the ALAssetsLibraryChanged notification.

Error Domain

Constant for the AssetsLibrary domain.

Error Codes

AssetsLibrary-related error codes

Notifications

static let ALAssetsLibraryChanged: NSNotification.Name

Sent when the contents of the assets library have changed from under the app that is using the data.

Relationships

Inherits From

Conforms To