7

I try to integrate a local Swift CocoaPod into a Swift Project, but it will not work :(

I simply created a Swift project with just one class and one function. This should be the CocoaPod. Here is the Podspecs:

Pod::Spec.new do |s|
    s.name          = "CocoaPodTest"
    s.module_name   = "CocoaPodTest"
    s.version       = "0.1"
    s.license       = { :type => "MIT", :file => "LICENSE" }
    s.author        = { "Stefan Sturm" => "stefan@urkman.de" }
    s.source_files  = "src/*.swift"
    s.requires_arc  = true
    s.ios.deployment_target = '8.0'
end

And then I created another simple App, that should use the pod. Here is the Podfile:

platform :ios, "8.0"
use_frameworks!

pod 'Alamofire'

# local pods
pod 'CocoaPodTest', :path => '../CocoaPodTest'

Now I try to access the class included using the pod:

Import the Module:

import CocoaPodTest

Then call the class and function:

Foo.doIt()

But here I get this error:

Use of unresolved identifier 'Foo'

I made a github project to show this error:github

Thanks for your Help :)

Urkman

Urkman
  • 1,298
  • 1
  • 16
  • 32

1 Answers1

10

Few points regarding Foo.doIt() (as in your repo at git hub)

  1. Your class is not public
  2. Your method is not public
  3. Your method is not class level method

Solve all these you are good to go

public class Foo {
    public class func doIt()
    {
        println("do it !!!")
    }
}
Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184