init(filenameExtension:conformingTo:)
Creates a type based on a filename extension and an existing supertype that it conforms to.
Declaration
init?(filenameExtension: String, conformingTo supertype: UTType = .data)Parameters
- filenameExtension:
The filename extension.
- supertype:
Another type that the resulting type must conform to; for example, Uttypedata or Uttypepackage.
Discussion
If the system finds no types with the provided filename extension and conformance, but the inputs are otherwise valid, it may provide a dynamic type. The initializer returns nil if the parameters aren’t valid.
This initializer is equivalent to calling:
UTType(tag: filenameExtension,
tagClass: .filenameExtension,
conformingTo: supertype)To get the type of a file on disk, use contentType.
A type depends on other attributes in addition to the filename extension, including whether the item is a directory.