How to wrap a Struct into NSObject

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 = 0; NSValue *anObj = [NSValue value:&struct withObjCType:@encode(aStruct)]; NSArray *array = @[anObj]; To … Read more