Is the UIPasteBoard data transferred to a deep copy or a shallow copy?

If an application installs data in UIPasteBoard iOS, is it deeply copied or shallowly copied?

+1
source share
2 answers

UIPastboard uses NSData to store data. Therefore, it is a deep copy.

From the official documentation for "setData: forPasteboardType:"

"Use this method to place raw data in a file cabinet. For example, you can archive a graph of model objects and transfer the result of an NSData object to the appropriate application through mapping using a custom cardboard type. (To place objects such as NSString, NSArray, NSDictionary, NSDate , NSNumber, UIImage, or NSURL objects on the file cabinet, use the setValue: forPasteboardType: method.) This method records the data for the first item in the file cabinet. Calling this method replaces any elements currently in the file cabinet. "

0
source

If you ask about - (void)setData:(NSData *)data forPasteboardType:(NSString *)pasteboardType, then this is definitely Deep.

strings, URL's, Colors, .

Images , CGImageRef, UImage NSCopying

, , .

+1

Source: https://habr.com/ru/post/1760504/


All Articles