This might work for you:
let allMedia = PHAsset.fetchAssetsWithOptions(fetchOptions) let allPhotos = PHAsset.fetchAssetsWithMediaType(.Image, options: fetchOptions) let allVideo = PHAsset.fetchAssetsWithMediaType(.Video, options: fetchOptions) print("Found \(allMedia.count) media") print("Found \(allPhotos.count) images") print("Found \(allVideo.count) videos")
Media types are defined as:
public enum PHAssetMediaType : Int { case Unknown case Image case Video case Audio }
Since this is not an OptionSetType , you cannot use it as a PHAsset.fetchAssetsWithMediaType and combine them for PHAsset.fetchAssetsWithMediaType , but PHAsset.fetchAssetsWithOptions may work for you. Just be prepared to filter out the types of audio from the result set.
source share