phasset 子类型 rawValue 含义 swift

phasset subtypes rawValue meaning swift

我正在尝试检测 PHAsset 的子类型。

asset.subtypes.rawvalue -> UInt

我找到了子类型 .video (rawValue: 0) 和 photoLive (rawValue: 8) 的含义,但是我有带 HDR 选项的 livePhoto 并且子类型 rawavlue 是 10,我找不到该值的含义。 有人拥有 PHAsset 子类型的所有 rawValue 含义吗? 谢谢

根据 documentation of PHAssetMediaSubtype:

Media subtypes are bit mask values, so you can combine them using bitwise operators to test for multiple subtypes.

该定义有助于:

typedef enum PHAssetMediaSubtype : NSUInteger {
    PHAssetMediaSubtypeNone = 0,
    PHAssetMediaSubtypePhotoPanorama = (1UL << 0),
    PHAssetMediaSubtypePhotoHDR = (1UL << 1),
    PHAssetMediaSubtypePhotoScreenshot = (1UL << 2),
    PHAssetMediaSubtypePhotoLive = (1UL << 3),
    PHAssetMediaSubtypePhotoDepthEffect = (1UL << 4),
    PHAssetMediaSubtypeVideoStreamed = (1UL << 16),
    PHAssetMediaSubtypeVideoHighFrameRate = (1UL << 17),
    PHAssetMediaSubtypeVideoTimelapse = (1UL << 18)
} PHAssetMediaSubtype;

所以,如果子类型是 10,那么 10 就是 8+2(唯一可能的 "sub-values"),它就是值 8(.photoLive)和值 2( .HDR)。