I need to store single bytes in objective c. So I may have a class interface like this:
@interface NAD : NSObject
@property (...) ... byte;
@end
I started off with uint8_t pointers, but this was getting difficult because they’re actually 4 bytes, or something.
So I switched to using NSData. But NSData deals in “bytes” (plural). This isn’t a problem necessarily, but is getting quite fiddly having to convert between all the time.
So is there a better way to store 1 byte (8 bits) in objective c variables?
Many thanks
Why
uint8_t *and not simplyuint8_t?To wrap it into an NSData object: