1

I create a swift cocoa touch framework according to create cocoapod with siwft

and it works fine, But there is another problem, my framework will dependency on other framework, such as SwiftyJSON.

And I try add

s.dependency "SwiftyJSON", "~> 2.3"

into the .podspec file. But when I try to build my 'Example', still error happens :

'No such module SwiftyJSON'

Ramkrishna Sharma
  • 6,961
  • 3
  • 42
  • 51
fcbflying
  • 693
  • 1
  • 7
  • 23

2 Answers2

0

Open your terminal and goto to your folder project. Then follow this step. Type this command in your terminal.

open -a TextEdit Podfile

Then copy this pod 'SwiftyJSON', :git =>'https://github.com/SwiftyJSON/SwiftyJSON.git'

put into Podfile. Then save it. And type this command in your terminal.

pod install

Hope it will help you.

MAS. John
  • 582
  • 6
  • 22
0

First you should install cocoapods package in your mac check this tutorial to do this How to install cocoapods?

Then you can install any cocoapods for any project by the following steps

  • open terminal
  • navigate to the root path for the project, example

    cd /Users/mac/Desktop/cocoatest
    
  • then type

    pod init
    

    (the will generate file "Podfile" ) open it the content for this file will be something like this:

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'
    
    target 'cocotest' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for cocotest
    
    end
    
    
    
    
    uncomment this line # platform :ios, '9.0' 
    
    and then add you cocoapods under this line 
    # Pods for cocotest
    

like

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'cocotest' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for cocotest


pod "SwiftyJSON", "~> 2.3"
end

then save the file

  • after that type pod install in terminal and it will create file with xcworkspace extension open it and that is your project
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
3lidev
  • 30
  • 1
  • 4