nomeyer
3/3/2016 - 2:08 PM

Copy a string to the system pasteboard in Objective-C

Copy a string to the system pasteboard in Objective-C

NSString *stringToCopy = @"Djyes";
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
BOOL success = [pasteboard setString:stringToCopy forType:NSStringPboardType];