xcode swift
As a beginner or seasoned iOS Developer, at some point in time, you must have come across CocoaPods. It’s one of the most important concepts to master in iOS Developer and in this tutorial we’ll be doing just the same.
作为初学者或经验丰富的iOS开发人员,在某些时候,您一定遇到过CocoaPods。 这是在iOS Developer中掌握的最重要的概念之一,在本教程中,我们将做同样的事情。
可可豆 (CocoaPods)
CocoaPods are dependency manager for your XCode projects.
CocoaPods是XCode项目的依赖项管理器。
Dependency Managers are responsible for managing libraries and frameworks added to your project. Instead of you downloading the libraries manually and adding it to the project, they do it for you.
依赖性管理器负责管理添加到项目中的库和框架。 他们无需手动下载库并将其添加到项目中,而是为您完成。
CocoaPods itself is a library that’s written in Ruby. It holds a central repository of all the third party libraries.
CocoaPods本身是一个用Ruby编写的库。 它拥有所有第三方库的中央存储库。
You can always search in the repository for the third party pod name and version.
您始终可以在存储库中搜索第三方Pod名称和版本。
什么是豆荚? (What is a Pod?)
A Pod is a single library or framework that’s added to our project.
Pod是添加到我们项目中的单个库或框架。
So where are these libraries installed and stored for the XCode Project?
那么,这些库在哪里为XCode项目安装和存储?
There’s a file Podfile in which we store our Pods and their versions.
有一个文件Podfile,我们在其中存储Pod及其版本。
Let’s first install CocoaPods on our mac through the terminal.
首先让我们通过终端在Mac上安装CocoaPods。
安装CocoaPods (Install CocoaPods)
Run the command – sudo gem install cocoapods
运行命令– sudo gem install cocoapods