I have a method that returns an integer and I now also want to return a small struct or class. If I was using C++ I would pass a reference to the struct in as a parameter. In iOS using ARC, I think the equivalent is to use a pointer to a pointer that has the __autoreleasing attribute which I find a bit cumbersome.
I could return an array containing the two values but then think I would be alloc’ing more than necessary and I could be using this a lot (100,000 calls).
Even with ARC, you can just pass in a struct by reference or an object pointer…
Pass the struct by ref just like you would in C++, e.g.
&aStructOr: