No, you do not want to send a pointer to an instance variable so that some other class can set the instance variable. Doing so is fragile and breaks encapsulation. It is an awful design pattern.
It is also completely unnecessary.
If Instance A can "send a pointer" to Instance B, then Instance A can easily send a reference to itself to Instance B. From there, Instance B can simply do [instanceA setShared:YES];
.
@interface B:UIViewController
@property(strong) A *controllerA;
@end
@interface A:UIViewController
@property BOOL dogDoorEnabled;
@end
@implementation A
...
- (void) doSomething
{
B *b = .... get an instance of B ...;
[b setControllerA: self];
}
@end
@implementation B
...
- (void) doSomethingElse
{
BOOL isCheeseOnFire = ... calculate whether the cheese is burning ...;
[[self controllerA] setDogDoorEnabled: !isCheeseOnFire];
}
@end
(Watch out for a retain cycle -- if A somehow retains B, directly or indirectly, then the (strong)
reference to A from B will create a retain cycle. Call [b setControllerA:nil]
when you want to break that cycle.)
Now, if there is some reason why you still think you need to send a pointer to the internal state of A to B, please update your question.