Home > OS >  Swift Defined constant for public.mpeg-4?
Swift Defined constant for public.mpeg-4?

Time:10-24

So I am loading a movie mp4 from PHPicker, using this line:

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

....

}

Are there defined constants for the types I can use instead of having to type them out as Strings "public.mpeg-4"?

If so, where can I find them declared in?

CodePudding user response:

You can use:

import UniformTypeIdentifiers

let movieType = UTType.mpeg4Movie
print(movieType)

This prints "public.mpeg-4"

You can find them declared here:

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

  • Related