简体   繁体   中英

XCode 4's code completion for methods in the .h file

In Xcode 3 I could first write my method in the implementation ( .m ) file; afterwards adding the same method to the interface ( .h ) file. At that point Xcode 3 made a code completion for the method written in the .m file. Sadly, Xcode 4 doesn't code complete my methods like Xcode 3 did. Does anyone else encountered this, and is there an option for this case?

An example:

The implementation .m file could look like this:

#import "Foundation, MyClass.h and stuff"

@implementation MyClass

-(void)mySampleMethod { NSLog(@"mySampleMethod"); }

@end

The interface .h file could look like this:

#import "Foundation and stuff"

@interface MyClass : MySuperClass {

 }

-(void)myS /* in Xcode 3 the code completion would now pop up with the 'mySampleMethod' from the .m, in Xcode 4 this does not happen */ ampleMethod; /* So I either copy/paste, or write the method */

@end

Xcode 4's indexing for code completion and cross-referencing uses the LLVM compiler under the hood, which enables it to only present completions that are valid in the context in which you attempt to use them.

One downside of this (vastly) increased precision is that the completion you're looking for in this case isn't available.

Of course, remember that in Objective-C only methods a class is actually exposing to another class need to be declared in header file for the class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM