Swift4 and ObjC, No type or protocol named

Hi,


I Have this code on my project:

import CoreLocation

class GPS: NSObject, CLLocationManagerDelegate {
...
...
}


and I get an error while building on the "MyProyect-Swift.h"


No type or protocol named 'CLLocationManagerDelegate'


This is the code generated:


...
...
@import CoreLocation;
...
...
@class CLLocationManager;
@class CLLocation;

SWIFT_CLASS("_TtC6Torneo3GPS")
@interface GPS : NSObject <CLLocationManagerDelegate>
...
...
@end
...
...


Any idea?


Tnaks.

Accepted Reply

problem solved...


I was importing the "-Swift.h" file on .mm file, and that's not supported, so I did create a .m file.

Replies

I tested by including in a Swift project the code: no problem


import CoreLocation 
 
class GPS: NSObject, CLLocationManagerDelegate { 

}


May look at this h ttps://stackoverflow.com/questions/24078043/call-swift-function-from-objective-c-class

Did you include the "-Swift.h" in any .m or .mm file?

problem solved...


I was importing the "-Swift.h" file on .mm file, and that's not supported, so I did create a .m file.