Uniform Type Identifiers
From Xojo Documentation(Redirected from UTI)
|You are currently browsing the old Xojo documentation site. It will go offline as of October 2, 2023. Please visit the new Xojo documentation site!|
Uniform Type Identifiers (UTIs) are used by the system to identify the type of files or in-memory data. For a file, the UTI is determined by the system with the help of its extension and its creator or its MIME type. As an example, Mac and iOS applications use UTIs to declare the format for data they place on a pasteboard. Mac apps use UTIs to declare the types of files that they are able to open.
- File Type Group Editor
- Using File Type Groups
- Webinar: All About File Types
Usage in Xojo
In Xojo, you specify UTIs for files using File Type Groups. The can then be used to select specific types of file or to control icons used with files owned by your apps.
The Clipboard class uses UTIs to identify its contents.
The SpotlightQuery class uses UTIs to search for specify files.
Uniform Type Identifiers support multiple inheritance, i.e. a UTI can be a child of any number of other UTIs. It is said to conform to another UTI. For example, the UTI for an AVI movie file is public.avi and it conforms to:
- public.movie: the base type for any movie
- public.data: the base type for physical files or data
- public.item: the base type for the physical hierarchy
- public.content: the base type for all document content
UTI System Tips
Getting All the UTIs Declared on a System
In the Terminal application (in Applications→Utilities→Terminal), type the following command (case-sensitive) to display a list of all UTIs declared by the system and other applications:
Getting UTI and Other Metadata of a Given File
In the Terminal application (in Applications→Utilities→Terminal), type the following command (case-sensitive):
mdls (followed by a space)
then drag & drop the file you want information on onto the Terminal window and press the return key.
Among other metadata used by Spotlight, you should see the following for an AVI file:
kMDItemContentType = "public.avi" kMDItemContentTypeTree = ( "public.avi", "public.movie", "public.audiovisual-content", "public.data", "public.item", "public.content" )
- kMDItemContentType contains the file's UTI
- kMDItemContentTypeTree is the list of all the UTIs the file conforms to.
To Learn More
- Uniform Type Identifier in the Apple iOS Developer Library
- Uniform Type Identifier on Wikipedia
- Uniform Type Identifier in the Apple Mac Developer Library