<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UniformTypeIdentifiers",
  "identifier" : "/documentation/UniformTypeIdentifiers/UTTypeReference/init(identifier:allowUndeclared:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Uniform Type Identifiers"
    ],
    "preciseIdentifier" : "c:objc(cs)UTType(cm)typeWithIdentifier:allowUndeclared:"
  },
  "title" : "init(identifier:allowUndeclared:)"
}
-->

# init(identifier:allowUndeclared:)

```
convenience init?(identifier: String, allowUndeclared: Bool)
```

## Parameters

`identifier`

The type identifier.

`allowUndeclared`

Whether to return an object if no type with the provided identifier
is known to the system.

## Return Value

A type object, or \c nil if the input \c identifier was not a Uniform Type Identifier.

## Discussion\abstract Create a type given a type identifier, optionally allowing identifiers that do not have an
active declaration on the current system.

When `allowUndeclared` is `YES`, this initializer can be used to obtain a type
object that keeps the “identity” of the input identifier even if no type with that
identifier is (currently) known to the system. In that case, the type is neither dynamic
nor declared, and has no conformances or tags (or any other properties).

If a type with the input identifier is known to the system, or if the input identifier is in
the dynamic namespace, it returns the same type object that \c typeWithIdentifier: would
return.

If `allowUndeclared` is `NO`, this initializer behaves identically to \c typeWithIdentifier:
given the same identifier.

One may use this, for instance, to create a concrete type object using an identifier that may
have been obtained from another system, and round-trip it through a subsystem without losing
the identity of the type.

If the input \c identifier is not a valid Uniform Type Identifier, the method returns \c nil .
See https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-SW2

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)