Hm, essayez de regarder le NSValue
à l'adresse https://developer.apple.com/documentation/foundation/nsvalue
Vous pouvez l'utiliser comme
struct aStruct
{
int a;
int b;
};
typedef struct aStruct aStruct;
Puis, en quelque sorte, l'envelopper dans une NSValue
comme un objet :
aStruct struct; struct.a = 0; struct.b = 0;
NSValue *anObj = [NSValue value:&struct withObjCType:@encode(aStruct)];
NSArray *array = @[anObj];
Pour retirer la structure de NSValue
utiliser :
NSValue *anObj = [array firstObject];
aStruct struct;
[anObj getValue:&struct];
Je suppose que plus tard, vous pourrez avoir une catégorie de NSValue pour rendre cela meilleur =D