setData(_:forPasteboardType:)
Puts data on the pasteboard for the specified representation type.
Declaration
func setData(_ data: Data, forPasteboardType pasteboardType: String)Parameters
- data:
The data object to be written to the pasteboard.
- pasteboardType:
A string identifying the representation type of the pasteboard item. This is typically a UTI.
Discussion
Use this method to put raw data on the pasteboard. For example, you could archive a graph of model objects and pass the resulting NSData object to a related app via a pasteboard using a custom pasteboard type. (To put objects—such as NSString, NSArray, NSDictionary, NSDate, NSNumber, UIImage, or NSURL objects—on the pasteboard, use the setValue(_:forPasteboardType:) method.) This method writes data for the first item in the pasteboard. Calling this method replaces any items currently in the pasteboard.