Use of undeclared type 'cocoapods library' - ios

I made a pod Here and pushed cocoapods succesfully. When I try to test my library I added
pod 'TDTextSlider'
to my podfile of another test project.It is installed and imported without error but when I try to use the library with this code
let td : TDTextSlider = TDTextSlider(frame: UIScreen.main.bounds)
I got "Use of undeclared type TDTextSlider" error but when I copy the swift.class manually its working.What am i doing wrong?

Make sure the classes you are trying to access are public or Open.

Related

Initialization error with CDYelpFusionKit

Trying to use the CDYelpFusionKit api for an app, and I'm getting an error on the first step:
let yelpAPIClient = CDYelpAPIClient(apiKey: "myapikeyhere")
It's saying that it's an
Use of unresolved identifier 'CDYelpAPIClient'
but I have already installed the dependencies with cocoapods.
You also need to import the framework
import CDYelpFusionKit

Use of undeclared type MGSwipeTableCell

I'm pretty new to swift and I have an error.
I'm trying to use pod MGSwipeTableCell https://github.com/MortimerGoro/MGSwipeTableCell
Installed pod 'MGSwipeTableCell' in pod file. Got it in pods in file inspector.
var cell = self.tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as! MGSwipeTableCell!
throws me an error Use of undeclared type 'MGSwipeTableCell'
There is a project on google disk https://drive.google.com/file/d/0By_KH6PH75z2OHlXek85YmRpcGc/view
It should be something simple I missed. Please help.
Add import statement in the beginning of file where you use it
import MGSwipeTableCell

Installing third party Objective-C library within Swift 3 / Xcode 8 (SharkORM)

Im pretty new to Xcode/Swift and want to install a third party library(SharkORM).
I drag'n'dropped the folder "SharkORM" into XCode and selected "Create groups". Then i created a file "Swift-Bridging-Header.h" and typed in #include “SharkORM.h” as described in the documentation. When i hold CMD and click on it it leads me to the interface declaration(good!?). Now when i try to use it: class MyClass: SRKObject { ... } i get an error: "Use of undeclared type 'SRKObject'". But i can CMD+click on it which leads me to the interface declaration again.
I tried to install with Cocoapod, too, with no success.
As posted on GitHub, it sounds like the header file you created has not been added to the build settings as the chosen bridging header.
That is the most likely scenario leading to the object not being defined in your swift code.
Check, if SharkORM.h contains SRKObject declaration. If not, find header file with it and place it to bridging header too

Cannot use class from TSMessage library imported via cocoaPods

I have installed cocoapods in a swift project and installed TSMessage through it. No problem there, but when I try to use it with this instruction:
TSMessage.showNotificationWithTitle("Success Notification !!!", type: .Success)
I get the error :
Use of unresolved identifier 'TSMessage'
I include it like this in my bridging header:
#import <TSMessages/TSMessage.h>
Actually I finally found the answer in this article, you have to add import TSMessages at the top of the file where you want to use this class

Using an Obj-C sub-project in a Swift application

My team has a few full Obj-C libraries we like te reuse in our projects. To do so, we usually set up a git submodule, and then add it to the xcode project as a sub-project (Using target dependency, link binary with library and updating the User Header Search Paths)
So far it's only been done in full Obj-C projects, and I'm now trying to use it in a Swift project but with very little success so far. I tried to add the briding-header file, referenced it in the project and filled it like so :
#import "MyLibraryHeader.h"
With the target header being in the User Header Search Paths.
It lets me build, but when using it in my Swift files:
let test = MyLib();
let secondTest = MyLib.classMethod1("some_arguments");
I get an EXC_BAD_INSTRUCTION on secondTest, and the following logs in the debugger:
(lldb) po test
error: <EXPR>:1:1: error: use of unresolved identifier 'test'
(lldb) po secondTest
error: Error in auto-import:
failed to get module 'MyProject' from AST context:
/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h:12:9: error: 'MyLibraryHeader.h' file not found
#import "MyLibraryHeader.h"
^
failed to import bridging header '/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h'
Found the following question with no answer : Xcode 6 crashing when using Objective-C subproject inside Swift
Any help would be appreciated.
I followed the HockeyApp tutorial that can be found here:
http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/integrate-hockeyapp-for-ios-as-a-subproject
In the end, I was on the right tracks but messed up the Header Search Paths:
Add subproject xcodeproj to the workspace
On the main project : Link binary with library, and add the subproject product library (Bonus points : add it as a target dependency too)
Update Header Search Paths (not User Header Search Paths) accordingly
Import your Library.h in the main project Bridging-Header.h file
What threw me off for a while is that the Swift Compiler setting for the Objective-C Bridging Header was not set automatically. Check the Build Settings for your target and ensure the "Objective-C Bridging Header" setting is not blank.

Resources