Problems with local CocoaPods and Swift

I am trying to integrate the local Swift CocoaPod in the Swift Project, but it will not work :(

I just created a Swift project with only one class and one function. It must be CocoaPod. Here are 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 application that should use pod. Here is the subfile:

 platform :ios, "8.0" use_frameworks! pod 'Alamofire' # local pods pod 'CocoaPodTest', :path => '../CocoaPodTest' 

Now I am trying to access the class included with pod:

Import module:

 import CocoaPodTest 

Then call the class and function:

 Foo.doIt() 

But here I get this error:

 Use of unresolved identifier 'Foo' 

I did a github project to show this error: github

Thank you for your help:)

Urkman

+6
source share
1 answer

A few points regarding Foo.doIt() (as in your repo in git hub )

  • Your class is not publicly available.
  • Your method is not publicly available.
  • Your method is not a class level method.

Decide everything that you are good to go

 public class Foo { public class func doIt() { println("do it !!!") } } 
+9
source

Source: https://habr.com/ru/post/985239/


All Articles