How to get custom file's UTI on iOS?

I have a file with custom file extension created by another app (not mine). I would like to have my app in the "open with..." menu for this file but I am not able to find out correct UTI for this file extension. I understand that in macOS I can use mdls command and "kMDItemContentType" field to find out UTI but I need some method that works also for iOS.

Thank you.

Answered by DTS Engineer in 717421022

What happens if you use the file extension to initialise a UTType? Like this:

import Foundation
import UniformTypeIdentifiers

let u = UTType(filenameExtension: "png")
print(u?.identifier ?? "-")
// prints: public.png

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

What happens if you use the file extension to initialise a UTType? Like this:

import Foundation
import UniformTypeIdentifiers

let u = UTType(filenameExtension: "png")
print(u?.identifier ?? "-")
// prints: public.png

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It worked, so simple. Thank you!

How to get custom file's UTI on iOS?
 
 
Q