Uniform Type Identifiers (or UTIs) are strings which uniquely identify abstract types. They can be used to describe a file format or an in-memory data type, but can also be used to describe the type of other sorts of entities, such as directories, volumes, or packages.

Type declarations appear in bundle property lists and tell the system several things about a type. Detailed information about the format and declaration of a UTI can be found in Uniform Type Identifiers Overview. A few key concepts that are found in the declaration include:

  • Conformance. Conformance relationships establish a multiple inheritance hierarchy between types. Type property values may be inherited at runtime according to the conformance relationships for each type. When a type's declaration does not include a value for particular type property, then the type's supertypes are searched for a value. Supertypes are searched depth-first, in the order given in the type declaration. This is the only way in which the declared order of the supertypes is significant.

  • Tags. A tag is a string which indicates the definition of the type in some other type identification mechanism, such as a filename extension or MIME type. The namespace of the other type identification mechanism is known as its class. Classes are themselves identified by uniform type identifiers so that the set of valid tag classes is easily extended in the future.

  • Type declarations may include several other properties: a localizable user description of the type, the name of an icon resource in the declaring bundle, a reference URL identifying technical documentation about the type itself, and a version number, which can be incremented as a type evolves. All of these properties are optional.


Creating Uniform Type Identifiers

func UTTypeCreatePreferredIdentifierForTag(CFString, CFString, CFString?) -> Unmanaged<CFString>?

Creates a uniform type identifier for the type indicated by the specified tag.

func UTTypeCreateAllIdentifiersForTag(CFString, CFString, CFString?) -> Unmanaged<CFArray>?

Creates an array of all uniform type identifiers for the type indicated by the specified tag.

Obtaining Tags from Uniform Type Identifiers

func UTTypeCopyPreferredTagWithClass(CFString, CFString) -> Unmanaged<CFString>?

Translates a uniform type identifier to a list of tags in a different type classification method.

Testing Uniform Type Identifiers

func UTTypeEqual(CFString, CFString) -> Bool

Returns whether two uniform type identifiers are equal.

func UTTypeConformsTo(CFString, CFString) -> Bool

Returns whether a uniform type identifier conforms to another uniform type identifier.

Obtaining Additional Type Information

func UTTypeCopyDescription(CFString) -> Unmanaged<CFString>?

Returns the localized, user-readable type description string associated with a uniform type identifier.

func UTTypeCopyDeclaringBundleURL(CFString) -> Unmanaged<CFURL>?

Returns the location of a bundle containing the declaration for a type.

OSType Conversion Utilities

func UTCreateStringForOSType(OSType) -> Unmanaged<CFString>

Encodes an OSType into a string suitable for use as a tag argument.

func UTGetOSTypeFromString(CFString) -> OSType

Decodes a tag string into an OSType.


Type Declaration Dictionary Keys

These are keys for values found in a UTI dictionary. For more information about UTI dictionaries, see Uniform Type Identifiers Overview.

Type Tag Classes

These strings identify other tagging classification schemes that a uniform type identifier can be converted to and from.

UTI Abstract Types

These are abstract uniform type identifiers that most other type identifiers are derived from.

UTI Concrete Types

These are uniform type identifiers for concrete types.

UTI Text Types

These are the uniform type identifiers for text content.

UTI Composite Content Types

Uniform type identifiers for content that includes multiple data types.

UTI Image Content Types

Uniform type identifiers for graphics content.

UTI Audio Visual Content Types

Uniform type identifier for audio and video content.

UTI Directory Types

Uniform type identifiers for different directory types.

UTI Application Types

Uniform type identifiers for application types.

UTI Contact Types

Uniform type identifiers for contact types.

UTI Miscellaneous Types

Uniform type identifiers for types that do not fit in other categories.