Every few months I try to re-learn Cocoa because I have no real use for programming iOS other than as a hobby. I'm going back over the basics and looking at what's different with the dot notations; for instance, seeing how the API has been updated to do common tasks by default.
There is plenty of documentation, which is good, but can also be a bad thing when you want to get up and running quickly. While it is slowly coming back, I consider myself a born-again neophyte on the subject, so any help is appreciated.
header file:
@interface FooClass : NSObject
{
@private
double foo;
}
@property (nonatomic) double foo;
@end
implementation file:
@implementation FooClass
@synthesize foo = _foo;
- (void) doSomething
{
}
@end
Inside the doSomething implementation, is it possible to have a local variable (e.g. bar
) that is a pointer to the class's foo
, such that when bar
is get/set foo
is updated (local alias)? I've tried variations of:
double bar = *self.foo;
double *bar = self.foo;
double *bar = *self.foo;
double *bar = &self.foo;
bar=5;
If so, what's the right syntax? Also, something is telling me this is a bad idea, so why might it be?
Edit: It looks like after some more searching I found something similar: objective-c: double pointers to property not allowed? Now, I'll try to make sense of it.