Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using UTType in Swift in Xcode 12 and iOS 14
import UniformTypeIdentifiers
//Show UTType properties for built-in type
//Show properties for looked up type
extension UTType {
/// Show some properties on the UTType
func printInfo() {
print("MIME type: \(preferredMIMEType ?? "No MIME Type")")
print("File Extension: \(preferredFilenameExtension ?? "No extension")")
print("Tags: \(tags)")
print("Identifier: \(identifier)")
static var word: UTType {
UTType.types(tag: "docx", tagClass: .filenameExtension, conformingTo: nil).first!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment