Search code examples
iosswift2cocoapodspodspec

Unable to create pod


I am trying to create a pod of library. I am following this tutorial. Pod lint successfully validate the pod spec. However when i import it as module i get error Use of unknown type. Here is the project

Update:

  • I just created a new pod project using the command pod lib create MZDownloadManager.
  • Then I updated the meta in podspecs file like description, summary etc.
  • Then I validated the podspecs using the command pod lib lint MZDownloadManager and it gives success.
  • Then I goto the Example project directory and run the command pod install.
  • It also successfully integrated the development pod.
  • Then I goto the pregenerated class ReplaceMe and created the test class named ReplaceMe and just define its testing initialiser.
  • Then I import the module. I still got the same error of Use of undeclared type

enter image description here

podspec file looks like this:

enter image description here

enter image description here


Solution

  • Finally I figured out the issue after spending so many hours. The problem was that my classes in my development pod is not declared as public and docs clearly states that:

    It's worth mentioning here, as this catches people quite often, a Swift library needs to have it's classes declared as public for you to see them in your example library.

    I hope this will save time of other developers facing similar issue.