Swift定义常量public.mpeg-4?



所以我要从PHPicker下载一个mp4电影,使用这一行:

result.itemProvider.loadFileRepresentation(forTypeIdentifier: "public.mpeg-4") { fileURL, error in
....
}

对于我可以使用的类型是否有定义的常量,而不必将它们键入为Strings "public.mpeg-4"?

如果有,我在哪里可以找到它们的声明?

您可以使用:

import UniformTypeIdentifiers
let movieType = UTType.mpeg4Movie
print(movieType)

打印"public.mpeg-4">

你可以在这里找到它们的声明:

https://developer.apple.com/documentation/uniformtypeidentifiers/system_declared_uniform_type_identifiers