Contents

enumerateGroups(withTypes:using:failureBlock:)

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

Declaration

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

Parameters

Discussion

The results are passed one by one to the caller by executing the enumeration block.

This method is asynchronous. When groups are enumerated, the user may be asked to confirm the application’s access to the data; the method, though, returns immediately. You should perform whatever work you want with the assets in enumerationBlock.

If the user denies access to the application, or if no application is allowed to access the data, the failureBlock is called.

Special Considerations

This method will fail with error ALAssetsLibraryAccessGloballyDeniedError if the user has not enabled Location Services (in Settings > General).

See Also

Enumerating Assets