[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[photos8] 01 Accessing Albums




"Accessing all albums (verbose version)"
| fetch albums |
fetch := PHAssetCollection
	fetchAssetCollectionsWithType: #Album
	subtype: #Any options: nil.
albums := fetch asArray.
self print: (albums inject: 'albums[',albums size,']=' into: [:total :each|
	total ,each localizedTitle asString ,'[',each estimatedAssetCount,'],'
]).


"Accessing smart albums"
| albums |
albums := PHAssetCollection smartAlbums.
self print: (albums
   inject: 'SmartAlbums[',albums size,']=' into: [:total :each|
	total ,each title asString ,'[',each estimatedCount,'],'
]).


"Accessing moments"
| albums |
albums := PHAssetCollection moments.
self print: (albums
   inject: 'Moments[',albums size,']=' into: [:total :each|
	total ,each title asString ,'[',each estimatedCount,'],'
]).


"Accessing burstPhotos"
| albums |
albums := (PHAssetCollection
	fetchAssetCollectionsWithType: #SmartAlbum
	subtype: #SmartAlbumBursts options: nil) asArray.
self print: (albums inject: 'SmartAlbumBursts[',albums size,']=' into: [:total :each|
	total ,each title asString ,'[',each estimatedCount,'],'
]).