init(importing:contentType:)
Using the type’s Transferable conformance implementation, instantiates a value from given data.
Declaration
init(importing data: Data, contentType: UTType?) async throwsParameters
- data:
Binary data that can be used to instantiate an item
- contentType:
A content type that corresponds to the structure of the data. If no content type is provided, the framework calls into every transfer representation provided in the implementation of the Transferable conformance (
transferRepresentationstatic property) until it finds one that can handle the data.
Discussion
The default implementation of this initializer is available to all types that conform to Transferable protocol.