Function to swap pointers in Objective-C

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-06-14T23:47:47Z Indexed on 2010/06/14 23:52 UTC
Read the original article Hit count: 143

Filed under:
- (void) swapController:(MyViewController*)controller1 
                         with:(MyViewController*)controller2
{
    MyViewController *swap = controller2;
    controller2 = controller1;
    controller1 = swap;
}

Looks like this doesn't work because I'm not passing references. How to do it anyway?

© Stack Overflow or respective owner

Related posts about objective-c