Instance Method

loadInPlaceFileRepresentation(forTypeIdentifier:completionHandler:)

Asynchronously opens a file in place, if doing so is possible, returning a Progress object.

Declaration

func loadInPlaceFileRepresentation(forTypeIdentifier typeIdentifier: String, completionHandler: @escaping (URL?, Bool, Error?) -> Void) -> Progress

Discussion

The system sets the isInPlace parameter to true if the system successfully opened the file in place, or false if it made a local copy. In either case, you must access the returned URL using an NSFileCoordinator object.

If the system created a local copy of a file, it will be automatically deleted after your file coordinator relinquishes its read access to the file.

See Also

Getting the Item’s Data

func canLoadObject(ofClass: NSItemProviderReading.Type) -> Bool

Returns a Boolean value indicating whether an item provider can load objects of a given class.

func hasItemConformingToTypeIdentifier(String) -> Bool

A convenience method equivalent to the hasRepresentationConforming(toTypeIdentifier:fileOptions:) method, but with the fileOptions parameter set to a value of 0.

func loadDataRepresentation(forTypeIdentifier: String, completionHandler: (Data?, Error?) -> Void) -> Progress

Asynchronously copies the provided, typed data into a Data object, returning a Progress object.

func loadFileRepresentation(forTypeIdentifier: String, completionHandler: (URL?, Error?) -> Void) -> Progress

Asynchronously writes a copy of the provided, typed data to a temporary file, returning a Progress object.

func loadObject(ofClass: NSItemProviderReading.Type, completionHandler: (NSItemProviderReading?, Error?) -> Void) -> Progress

Asynchronously loads an object of a specified class to an item provider, returning a Progress object.

func hasRepresentationConforming(toTypeIdentifier: String, fileOptions: NSItemProviderFileOptions) -> Bool

Returns a Boolean value indicating whether an item provider contains a data representation conforming to a specified uniform type identifier (UTI) and to specified open-in-place behavior.

func registeredTypeIdentifiers(fileOptions: NSItemProviderFileOptions) -> [String]

Returns an array with a subset of type identifiers for the item provider, according to the specified file options, listed in the same order in which they were registered.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software