I am just stumbling over adding class objects to an array:
I get an error when trying to add class objects to an NSArray
because e.g. NSString.class does not conform to ObjcObject. There
is some functions in the API that require arrays of class
objects, e.g. in NSPasteboard:
NSPasteboard pb = NSPasteboard.generalPasteboard() ;
NSArray classes = NSArray.arrayWithObjects(NSString.class,
NSAttributedString.class, null) ;
NSString pbItem = cast(NSString)
pb.readObjectsForClasses_options(classes, null).lastObject() ;
Sure, there are other functions in NSPasteboard, and
readObjectsForClasses_options is not the only way to get the
pasteboard items, but a great convenience in given settings.