[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[photos8] 04 listing favorites
"Listing assets in Favorites"
| selected tuples |
selected := PHAsset in: (PHAssetCollection smartAlbum: #Favorites).
selected isEmpty ifTrue: [
^self error: 'We need images/videos in favorites to perform this test'
].
tuples := Array new.
selected do: [:asset|
PHImageManager default
withImageForAsset: asset ofSize: CGSize @ 120"(CGSize width: 640 height: 480)"
do: [:image :info|
tuples add: (Array with: image
with: asset mediaTypeSelector
with: asset extent
)
].
].
self print: '// ',tuples size,' images captured '.
TableViewManager
choose: tuples configure: [:aManager|
aManager when: #needsTitleFor: do: [:item| item second ].
aManager when: #needsDetailFor: do: [:item| item third ].
aManager when: #needsImageFor: do: [:ref | ref item first ].
] doing: [:item| item inspect ]