This means that the parameter is used to send in data, as well as to receive out data.
Let's see an example implementation:
- (void)increment:(inout NSUInteger*)number { *number = *number + 1; } NSUInteger someNumber = 10; [self increment:&someNumber]; NSLog(@"Number: %u", someNumber);
This pattern is often used with C structures, such as CGPoint , because they are passed by value (copied).
Also note that inout is absolutely not required here, but it helps the compiler to understand the meaning of your code and improve performance during optimization.
There are also separate in and out annotations, but as far as I know, there are no compiler warnings when you use them incorrectly, and it seems that Apple no longer uses them.
Sulthan
source share