Nathan H
Nathan H

Reputation: 49441

Swift Bridging header expected ';' after method prototype

I've created a new Swift project and decided to make use of the "Bridging Header" feature of XCode to use several Objective-C files.

It all worked fine, except for one specific header, which when included in the bridged, throwed:

<unknown>:0: error: something/include/SomeClass.h:269: expected ';' after method prototype

Looking at the line, the code looked something like:

-(void) searchField:(NSString*) searchField
         notBetween:(NSNumber*) number1
                and:(NSNumber*) number2;

If I change the word and to anything else (qwerty) the compile error goes away! The same code works fine with an Objective-C project.

Thoughts?

Upvotes: 0

Views: 374

Answers (2)

Nathan H
Nathan H

Reputation: 49441

This was a bug, fixed in Beta 5.

http://openradar.appspot.com/17110619

Upvotes: 0

and is a C(++) macro, defined in < iso646 >.

You shouldn't use C/C++/Objective-C keywords and macro names in your Swift code exported outside Swift. This is a rule of thumb of most languages when interacting with the C family.

Upvotes: 1

Related Questions