clusterlayer-plugin-ios icon indicating copy to clipboard operation
clusterlayer-plugin-ios copied to clipboard

Question: Properties starting with underscore?

Open sbaskaran opened this issue 11 years ago • 2 comments

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

sbaskaran avatar Jun 11 '14 22:06 sbaskaran

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.

nixta avatar Jun 13 '14 19:06 nixta

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;
}

sbaskaran avatar Jun 17 '14 18:06 sbaskaran