Search code examples
iosswiftcocoapodspodspec

Creating a CocoaPod


For 2 days I am trying to make a cocoapod in swift using Xcode 7.1.1

Problem is when I install pod using pod install, my pod files get integrated with the project but I can not use my pod files. The reference is missing. The project does not recognize my pod files.

Tutorials I have tried:

  1. https://guides.cocoapods.org/making/using-pod-lib-create
  2. http://code.tutsplus.com/tutorials/creating-your-first-cocoapod--cms-24332
  3. http://useyourloaf.com/blog/creating-a-cocoapod.html

Both pod lib lint and pod spec lint passes validation. Also I was successful in pod trunk push

You can get the pod in your project using

pod 'WARDoorView', '~> 0.1.2'

You can try the pod using

pod try WARDoorView

If you download the repo, the example project has compiler error in ViewController.swift:

Use of undeclared type 'WARDoorView'

But I can see the WARDoorView.swift under pods

The repository is at
https://github.com/rishi420/WARDoorView


Solution

  • God... after 3 days I'm able to find the issue.

    I had to make my class public and any function I want to call from outside public.

    public class WARDoorView: UIView { ...
    
    public func doorOpen(angle: Double ...
    
    public func doorClose(duration: NSTimeInterval ...
    

    I thought public was the default. I was wrong.

    New pod using

    pod 'WARDoorView', '~> 1.0.2'