Sazzad Hissain Khan
Sazzad Hissain Khan

Reputation: 40136

Use of Unresolved Identifier 'PHAssetMediaTypeImage'

I am using PHAsset in swift. PHAssetMediaTypeImage is not resolved. Can anyone help.

enter image description here

Upvotes: 1

Views: 1563

Answers (2)

Daniel Klöck
Daniel Klöck

Reputation: 21137

In swift, PHAssetMediaTypeImage is just .Image and PHAssetMediaTypeVideo is just .Video:

if asset.mediaType == .Image {

}

if asset.mediaType == .Video {

}

Upvotes: 1

Nazmul Hasan
Nazmul Hasan

Reputation: 10590

Resolvable this way PHAssetMediaType.Image and PHAssetMediaType.Video

fetch all assets, then sub fetch only the range your need

    var assets = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: fetchOptions){

}

also check apple documentation

Upvotes: 1

Related Questions