I'm now using Swift class in my existing Object-C project.In my Swift class, I'm using CLLocationManagerDelegate. Everything works well. However, when ProjectName-Swift.h is generated, an issue in ProjectName-Swift.h file shows that Can't find protocol declaration for 'CLLocationManagerDelegate'. I tried to silence the issue by importing CoreLocation/CoreLocation.h in ProjectName-Swift.h. It worked. But after compiled a few times, CoreLocation/CoreLocation.h was gone because ProjectName-Swift.h is generated from my swift class. And the issue comes again.
ProjectName-Swift.h
Here is my swift class (No issue here)
import UIKit
import CoreLocation
@objc class SSDLocationHelper: NSObject, CLLocationManagerDelegate {
let locationManager = CLLocationManager()
func findUserLocation() { ...
}
The solution is to import the framework in your project bridging header.
ProjectName-Bridging-Header.h:
#import <CoreLocation/CoreLocation.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With