Why Does Xcode Line-Out Autocomplete Methods for Selector

Why does Xcode line-out autocomplete methods for selector?

Instead of typing tapH and asking for autocomplete, type self.tapH and ask for autocomplete. The problem goes away.

So, yes, I do rather think it's a bug (unless Swift is changing so that you can't omit the class in a method reference), but there's also an easy workaround.

Objective-c Xcode method autocomplete style

You probably could use Uncrustify with the align_oc_msg_colon_span value set to 1. See this SO question for more informations.

If you want to make it more automatic, you might want to give BBUncrustifyPlugin a try, and bind its "Uncrustify Active File" menu command to a keyboard shortcut.

The BBUncrustifyPlugin is available in Alcatraz (along with a bunch of other very neat plugins), or you could install it by hand (but I'd recommend trying Alcatraz. Really :)).

This will not make it totally automatic (as "re-indent as you type" automatic) but this is pretty close in my opinion.

Xcode completion doesn't recognize the type of my variable

I'm creating an object with:

NSMenu *appMainMenu = [[NSMenu alloc] initWithTitle:@"MyApp"];

You should allocate it from [NSMenu menuZone].

(It's the same zone as the default as of 10.6.1, but as long as the documentation says you should use [NSMenu menuZone], you probably should use [NSMenu menuZone].)

However, when I try to call any instance method such as:

[appMainMenu addItemWithTitle:@"MyTitle" action:@selector(myaction:) keyEquivalent:@"t"];

XCode offer some completions, but none appear to come from NSMenu.

First, it's Xcode, with a lowercase c.

Try saving. Sometimes Xcode doesn't realize I've created a variable until I save the file, thereby provoking it to rebuild whatever the completions are coming from.

Firebase autocomplete API's cause compiler error Swift

It seems like your Firebase framework is not the latest version?(as the latest one is now supporting the Swift 3 syntax).
Try pod update.

How to add information to the method fill helper in XCode?

The help hints come from the installed docsets.

You can generate and install docsets for your own custom classes and install them in Xcode to get this extra information as well as auto-completion.

One way that is convenient is appledoc

This uses a convenient and familiar syntax, and produces web formatted output as well as docsets and can even be configured to generate and install the docsets automatically.

Xcode doesn't warn for invalid init methods

First of all, interesting question!

XCode uses gcc output to create list of warnings and errors and some other (internal) mechanism to create list of autocomplete suggestions. Autocomplete is more clever sometimes (and sometimes not, you know :)

But why doesn't gcc reports warning? You already have an answer -- alloc returns id.

My answer is not an 'answer', but I want to share with you with the next. (Sorry, I don't have Mac at a moment, so it is not Apple's objective-c)

shum@shum-laptop:/tmp/shum$ cat test.m 

#import <objc/Object.h>

@interface Test1 : Object
{
}

- (id) blah;

@end

@interface Test : Object
{
}

@end

@implementation Test

@end

int main()
{
Test* test = [[Test alloc] blah];
return 0;
}

shum@shum-laptop:/tmp/shum$ gcc test.m -lobjc
shum@shum-laptop:/tmp/shum$

No warning. But try to comment - (id) blah in Test1 interface

shum@shum-laptop:/tmp/shum$ gcc test.m -lobjc
test.m: In function ‘main’:
test.m:24: warning: no ‘-blah’ method found
test.m:24: warning: (Messages without a matching method signature
test.m:24: warning: will be assumed to return ‘id’ and accept
test.m:24: warning: ‘...’ as arguments.)
shum@shum-laptop:/tmp/shum$

Can make a conclusion: if you make a typo calling init and there are no selector with the same name, then gcc should warn you; in a bad case, when a selector with the same name exists somewhere, gcc will not warn you. I don't have Mac and XCode at a moment, could you please test it?

[EDIT]
Just tested it with the xcode. The same behavior.

Is there a key combination in Xcode to implement a Protocol?

I have not seen that feature in Xcode.
But it seems like someone could write a new user script called "Place Implementor Defs on Clipboard" that sits inside of Scripts > Code.

You did not find this useful.



Related Topics



Leave a reply



Submit