D/Objective-C 64bit

Christian Schneider via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Nov 16 03:16:59 PST 2014


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.


More information about the Digitalmars-d-announce mailing list