Contents

init(exportedAs:conformingTo:)

Creates a type your app owns based on an identifier and a supertype that it conforms to.

Declaration

init(exportedAs identifier: String, conformingTo parentType: UTType? = nil)

Parameters

  • identifier:

    The identifier of your type.

  • parentType:

    A type to extend for your own type.

Discussion

Defining a type with this initializer asserts that you own the type definition. For example, you might define your file format in code to use it to save or open files in your app.

extension UTType {
    /// The type of my file format.
    public static let myFileFormat = UTType(exportedAs: "com.example.myfileformat")
}

See Also

Creating a type