Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Properties starting with underscore? #10

Open
sbaskaran opened this issue Jun 11, 2014 · 2 comments
Open

Question: Properties starting with underscore? #10

sbaskaran opened this issue Jun 11, 2014 · 2 comments

Comments

@sbaskaran
Copy link

Aren't ivars the ones created with a prefix underscore?
Referring to AGSCluster class here

@nixta
Copy link
Owner

nixta commented Jun 13, 2014

Indeed, automatically created ivars for a property will be the property name preceded by an underscore (or can be declared explicitly with a @synthesize statement).

We can drop the leading underscore or rename the properties. They're named the way they are to distinguish them unambiguously from the public features and clusters properties.

The clusters property no longer exists anyway, so feel free to suggest a good name for these.

@sbaskaran
Copy link
Author

How about an ivar for both clusters and features in the implementation file?

In AGSCluster.h (As-is)

//All features, including (recursively) those of child-clusters
@property (nonatomic, readonly) NSArray *features; 

In AGSCluster.m, create instance variables

@interface AGSCluster () {
    NSMutableArray *_features;
        NSMutableArray *_clusters;
}

//getters
-(NSArray *)features {
    return _features;
}

-(NSArray *)childClusters {
    return _clusters;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants