Possible Duplicate:
How to wrap a Struct into NSObject
Can the new Clang Objective-C literals be redirected to custom classes?
I have a custom struct:
typedef struct {
float f1;
float f2;
} MYCustomStruct;
that I need to add to an NSArray
. I've already written a category to create NSValues
of these structs, which I then add to the NSArray
, however I'd like to simplify that even further using boxed expressions, if possible. I'd love to be able to do this:
@[@(instanceOfMYCustomStruct)];
however, I'm confronted with the following error:
Illegal type 'MYCustomStruct' used in a boxed expression
Is there a way to use boxed expressions with custom structs?