Get file size of PHAsset without loading in the resource?
问题 Is there a way to get the file size on disk of a PHAsset without doing requestImageDataForAsset or converting it to ALAsset ? I am loading in previews of a user's photo library - potentially many thousands of them - and it's imperative to my app that they know the size before import. 回答1: You can grab the fileSize of a PHAsset and convert it to human readable form like this: let resources = PHAssetResource.assetResources(for: yourAsset) // your PHAsset var sizeOnDisk: Int64? = 0 if let