How to wrap a Struct into NSObject
问题 this is supposed to be trivial… I think, but I can\'t find a way how to wrap a Struct variable into an NSObject . Is there a method to do so? If not, how would I go about adding a struct into an NSMutableArray ? Thanks. 回答1: Hm, try to look at the NSValue at https://developer.apple.com/documentation/foundation/nsvalue You can use it like struct aStruct { int a; int b; }; typedef struct aStruct aStruct; Then sort of "wrap" it to an NSValue object like: aStruct struct; struct.a = 0; struct.b =