Pass double pointers in ObjectiveC  
                    

In ObjectiveC, there is no such thing called "pass by reference" like in C++, So if you wanto modify the object inside the method, then you have to pass double pointers. When you call the method[e.g. swap], you need to use & as address operator to get the address of a pointer

                    +(void)swap:(MyClass* __strong*)p1 second:(MyClass* __strong*)p2 {
                        MyClass* tmppt = *p1;
                        *p1 = *p2;
                        *p2 = tmppt;
                    }

                    MyClass* p1 = [MyClass alloc];
                    MyClass* p2 = [MyClass alloc];

                    [MyClass swap:&p1 second:&p2]
                    
    __strong - is the default, strong reference keeps the object "Alive". 
    __autoreleasing - denote argument passed by reference(id *) and are autoreleased on return
    p1 - is a pointer in [MyClass* p1] 
    &p1 - is the address of pointer p1 in [MyClass* p1]