diff --git a/TLPhotoPicker/Classes/TLAssetsCollection.swift b/TLPhotoPicker/Classes/TLAssetsCollection.swift index 7758e44..be48d4e 100644 --- a/TLPhotoPicker/Classes/TLAssetsCollection.swift +++ b/TLPhotoPicker/Classes/TLAssetsCollection.swift @@ -358,6 +358,11 @@ public struct TLAssetsCollection { return count + (self.useCameraButton ? 1 : 0) } } + var assetCount: Int { + get { + return self.fetchResult?.count ?? 0 + } + } init(collection: PHAssetCollection) { self.phAssetCollection = collection diff --git a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift index 966b32a..f301e39 100644 --- a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift +++ b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift @@ -611,7 +611,7 @@ extension TLPhotosPickerViewController: TLPhotoLibraryDelegate { func loadCompleteAllCollection(collections: [TLAssetsCollection]) { self.collections = collections self.focusFirstCollection() - let isEmpty = !self.collections.contains(where: { $0.count > 0 }) + let isEmpty = !self.collections.contains(where: { $0.assetCount > 0 }) self.subTitleStackView.isHidden = isEmpty self.emptyView.isHidden = !isEmpty self.emptyImageView.isHidden = self.emptyImageView.image == nil