Contents

loadObjects(ofClass:completion:)

Creates and loads a new instance of the specified class for each drag item in the session.

Declaration

func loadObjects(ofClass aClass: any NSItemProviderReading.Type, completion: @escaping ([any NSItemProviderReading]) -> Void) -> Progress

Parameters

  • aClass:

    A class conforming to the Nsitemproviderreading protocol.

  • completion:

    The block that is executed after all objects are loaded.

Mentioned in

Return Value

An aggregate of the load progress for each object that is loaded.

Discussion

You can use this method only in the drop interaction delegate’s implementation of the dropInteraction(_:performDrop:) method. This method is called after the user drops the items into the destination view.

The completion handler is called on the main queue. It provides an array of all objects created, in the same order that the drag items were added to the drag session.