Guilherme Guilherme - 1 year ago 140
iOS Question

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?

Answer Source

Be sure to declare you class as public, as stated here

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!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download