Take the 2-minute tour ×

I saw a similar question addressing differences of the code completion between Xcode 3.2 and Xcode 4. My question addresses a specific behaviour of Xcode (3.2).

When I declare "private" methods in a class extension, these methods are visible in the code completion lists, where they shouldn't be visible.

An example (AClass.m):

#import "AClass.h"

@interface AClass()
- (void)someMethod;

@implementation AClass
- (void)someMethod
    // do something here

When I import AClass.h to some other class and create an AClass-instance...

AClass *test = [[AClass alloc] init];

Xcode's code-completion shows the "private" method "someMethod":

[test som     // Shows someMethod, though it shouldn't be visible here

At that point, this method is visible, even if it shouldn't be, because it's unknown here - it's not defined in the header-file. If I send the message [test someMethod] at that point and build the thing, I get a warning, that the object might not respond - as expected.

It actually does respond, but this is confusing behaviour, especially for someone else, who wants to use my class.

That affects @property / @synthesize as well, since they "just substitute methods". I want to access all of my private ivars by properties for a) having homogene code while b) being able to influence the use of ivars (like lazy instantiation). On the other hand all private stuff shouldn't be visible (in code completion) to anyone using my classes, to make it easier to use them.

Is there any way to change this behaviour?

Is the missing validation of context in Xcode 3.2 the reason, why code-completion shows this kind of methods, where they shouldn't be visible?

Is that behaviour different in Xcode 4 (because of context-validation)?

I still use Xcode 3.2, because I wanted to finish a project before switching and adapting myself to Xcode 4.

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.