Cocoapods integration and initialization - swift

Based on the new swift project to integrate cocoapods, the operation process is similar to object-c. The following operations are based on the successful installation of cocoapods;

First, access the terminal to the project root directory

cd xxx工程文件夹路径xxx

Secondly, create the Podfile file

vim Podfile

Secondly, after the creation is successful, you will get a Podfile file in the root directory of the project. You can edit it directly through the terminal or open the file in the root directory for editing.

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

# Project name
target 'IMedPhone' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  
  # Add your SDKs
  pod 'Alamofire' // 添加所需的 SDK 即可

  # Pods for IMedPhone

  target 'IMedPhoneTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'IMedPhoneUITests' do
    # Pods for testing
  end

end

Finally, after editing the Podfile file, try to install it through Pod.

pod install

 

The above operation is based on cocoapods version 1.12.1

fyhsurvivors@survivors-deMacBook-Pro IMedPhone %  pod --version
1.12.1

[Extra] If you encounter the following exceptions, please refer to it:)

CocoaPods could not find compatible versions for pod ““:


The above is all the content shared this time, I hope it can be helpful to everyone!

Guess you like

Origin blog.csdn.net/survivorsfyh/article/details/131824151