How to import AppDelegate in Cocoapod classes - ios

Can anyone suggest me a solution to import AppDelegate or any other custom classes in Cocoapod classes

I had to import a UIColor category in my cocoa pod library, so what I did, I added it as an existing file in the library unchecking Copy items if needed. This will not create another copy of the file.
It is working well. May be you have to do the same.

Related

How to import Objc Files into my Swift files within my custom cocoapods framework?

Simple explanation. I have created my own pod with name BSSelectableView, but within I need to use two files written in Objective-C. What do I need to achieve?
I need to make it visible within my Swift files, and also for people who will install my pod.
Your Target needs a Bridging Header.
This is an Objective-C-Header-File with the name [TargetName]-Bridging-Header.h
Within this file, you have to #import all Objective-C-Headers you want to use in your Swift-Files.
You don't have to import anything in your Swift files.
More information about Swift and Objective-C mixed projects
You need to create a [TargetName]-Bridging-Header file in your project.
import all the header files in bridging header file
Now you can use all objective c file in swift.

Creating pod, use of undeclared type for my pod classes

I'm creating a pod in swift to use with cocoapods, but I'm having a strange problem when trying to use it.
My pod is downloaded normally after 'pod install' and I can import it via 'import MyPod'. So far so good, but when I try to access my classes in the pod, I get the message
"Use of undeclared type 'NameOfTheClassIwantToUse'".
If i go to my pod folder in Pods project, all the files are there, but I cannot use it.
I also noticed when I go into the import 'MyPod' with command+click I can see just few imports instead of all my classes, like:
import MyPodProjectName
import MyPodProjectName.Swift
import Foundation
import UIKit
public var MyPodProjectNameVersionNumber: Double
While other imports has all the classes that are supposed to be available upon importing.
Does anyone has a clue on what am I missing here?
Be sure to declare you class as public, as stated here
https://guides.cocoapods.org/making/using-pod-lib-create
As stated there:
It's worth mentioning here, as this catches people quite often, a Swift library needs to have its classes declared as public for you to see them in your example library.
So, just declare namespace "public" on you classes and you are good to go
I had the same problem, and this worked for me!
Yes you need to declare your class, methods and relevant variables as public and don't forget to import your module on top of the class you need.

How do I use a local Objective-C file in a pod class file I'm editing?

I have a library that I'm using through Cocoapods, and I'm modifying it slightly. I have a class I've created in my normal project (outside of Cocoapods) that I want to use in the Cocoapod, but when I try to import the file it says that file doesn't exist.
As pods are seemingly achieved through a separate project within the same workspace, I assume that's the reason why I can't access it. How would I access it, however? Do I have to import the file separately into the Pods project and then maintain two separate versions? Or is there a better way?

No such modules in Swift but the .swift is present

I am not able to import a swift NSManaged subclass to any other swift source code file. I created one Entity and then i created NSManaged subclass for that entity.
But i am not able to import that file to any other source code file. I might be missing some settings in the Xcode.
Please check this image.
You shouldn't write imports for source files, only for libraries and frameworks. Your class USer should be available. Btw, check it's spelling

How can I import firefox-ios to my obj-C project

I wonder how can I import https://github.com/mozilla/firefox-ios to my existing Obj-C project. While it does not a framework, I could not import sources of it in my Obj-C project files when I added the project into workspace. I tried to convert it to a static library, but I could not figured it out. I have a little bit experience on Swift and this creating static library thing. Actually, I am not sure this is the right way to do.
Thanks
You should check the Apples documentation about using Swift in Objective-c.(The Importing Swift into Objective-C part)
You can add a Swift-module header and import your .swift files and use them in your objective-c code.

Resources