Cannot find protocol declaration for 'CLLocationManagerDelegate'; did you mean 'NSLayoutManagerDelegate'? - swift

I'm 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 "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.

Related

Swift can't see second module's header

We have a swift module that imports and obj-c module and that works fine.
BUT if a swift module imports a obj-c module that imports another obj-c module, swift can’t see the second module’s headers
Anyone seen this happen before?
detail:
I created a module called ModelFoundation that has a protocol that other modules can assume our models conform to so they don’t deal directly with PIModel.
Now ExperimentManager complains when it imports PIModels saying it can’t find ModelFoundation.h (imported by a file in PIModels)
If in the PIModel module file I import ModelFoundation via #import "my/path/to/ModelFoundation/ModelFoundation.h" then it works
note: maybe has to do with how I built. we use xchammer making xcode project

Swift Namespacing Issue

I have created a class named Bundle, which I'd really like to remain named that way, as it perfectly describes what it's for in my project.
Now, I'm using Swift's Bundle in some code and now those names are conflicting. I had this issue before when I created the class Set. I was able to solve that by putting Swift.Set when I wanted to use the standard Set class, as I found in this answer on exactly this matter.
I also tried to apply that solution my Bundle problem, but Xcode complains:
Module 'Swift' has no member named 'Bundle'
Any idea why it does work for Set, but not Bundle?
Thanks!
Bundle is defined in the Foundation library, not in the Swift standard
library:
let mainBundle = Foundation.Bundle.main

Only factor methods can have swift_name attribute Mapbox

I'm using cocoa pods and map box was working fine but I installed an update and this message appeared:
Now I can't run my project. I'm using map box iOS sdk 3.3.4. What should I do to fix this issue?
According to apple documentation:
The Swift compiler automatically imports Objective-C code as conventional Swift code. There may be edge cases in your code that are not automatically handled. If you need to change the name imported by Swift of an Objective-C method, enumeration case, or option set value, you can use the NS_SWIFT_NAME macro to customize how a declaration is imported. See more.
So all what I did was delete the implementation of the NS_SWIFT_NAME and with that I was able to build the project. I don't know what made this error appear but this was the best solution I found.
Example:
From this:
- (instancetype)recordWithRPM:(NSUInteger)RPM NS_SWIFT_NAME(init(RPM:));
To this:
- (instancetype)recordWithRPM:(NSUInteger)RPM;

Import swift framework in swift project issue

I checked all answers to similar problem and none helped.
I created a simple swift framework for testing. When I drag it to a Objective-C project, I can then import the header and use my simple class within Objective-C classes, np. Now when I do the same with a swift project, I can't reference my class (gives unidentified etc ...), I can import the header without error, just xcode can't see the class. That class is public and has one simple public method.
What does xcode need to be able to see that class in swift project when the process is so easy in OBJ-C project?

Compiler error when using AlwaysRightInstitute/SwiftSockets

I'm try to write a small game on IOS using socket and I've had a java socket server running with Flash client, but I got complier errors when I add the AlwaysRightInstitute/SwiftSockets source code to my swift project, and I did nothing after doing this
Here is the project structure:
the selected group "ARISockets" is the source code I drag into my project
and here are the errors(Use of unresolved identifier 'ari_fcntIVi'):
It seems that the errors cause by lack of some import file and I found "ari_fcntIVi" in ARISockets/UnixBridge.c,but I'm a really newer to Swift/Objective-C/C (I'm a AS3 developer), so that sucks me :/
I had the same problem with this library.
You need to create a Bridge file similar to "Import Objective-C into Swift" but this is C:
How to call Objective-C code from Swift
The issue was that you just copied over the sources instead of embedding the SwiftSockets framework. The ari_ prefixed functions used to required the bridging header of the SwiftSockets framework.
Having said that, the current SwiftSockets doesn't use bridging headers anymore, and you can directly embed the sources.