为什么我们必须使用依赖管理器?
Why we have to use dependency manager?
我正在为 IOS 开发一个应用程序,我必须使用一些框架。
如您所知,Cocoa pods 和 Carthage 是 iOS 和 mac OS 的依赖管理器
我的问题是 "why we have to use dependancy manager?, instead of using dependancy manager just clone that project[was written by other programmer and can be used as framework] and drag and drop to your project ??"
感谢您的回答
您需要考虑的几件事是:
在新版本发布时更新您的依赖项。
正在更新多个平台的依赖项。
相互依赖的框架和依赖框架的不同框架版本。
基本上,您花在维护项目依赖项上的时间会随着项目的增长而增加。依赖管理器可让您避免所有这些不必要且无聊的工作。
使用 DM 而不仅仅是导入框架还有很多其他原因。更多关于你可以找到 here. And here.
为什么图书馆是你的朋友
While you aren’t strictly required to use third-party libraries or
frameworks, they can definitely save you a lot of time and let you
focus on polishing your app instead of typing out countless lines of
code that you simply don’t need to write.
You can use third-party frameworks and libraries without a dependency
manager too, and you can get hands-on tutorials about them right here
on this site. For example, there’s our Alamofire tutorial, and our
SwiftyJSON tutorial.
Without a dependency manager, you simply add each library’s code to
your project manually. However, this approach has several
disadvantages:
- Updating a library to a new version can be difficult, especially if several libraries must be updated together because one depends on
another.
- Including a library in your project makes it tempting to make local changes to the code, making it harder to update to a newer version
later.
- Determining the current versions of libraries used in your app can be hard to do, especially if you don’t proactively keep track of them.
- Finding new libraries can be difficult without a central location to see all the available libraries.
- CocoaPods helps you overcome all of these issues and more. It fetches library code, resolves dependencies between libraries, helps
you search for and discover new libraries, and even sets up the right
environment to build your project with minimum hassle.
礼貌
https://www.raywenderlich.com/97014/use-cocoapods-with-swift
在某些时候您可能想使用 3rd 方代码来获得额外的功能或其他东西,您可以复制源代码,但将来您将如何更新它?继续应对!!
另外,您的某些第 3 方代码可能依赖于其他第 3 部分代码,如果您复制它两次,您将得到重复的符号。
依赖管理器为您处理所有这一切。
我的建议是使用 Carthage 或子模块,但不要使用 CocoPods,任何接触项目文件的东西都不是 Apple 的好习惯。
我正在为 IOS 开发一个应用程序,我必须使用一些框架。 如您所知,Cocoa pods 和 Carthage 是 iOS 和 mac OS 的依赖管理器 我的问题是 "why we have to use dependancy manager?, instead of using dependancy manager just clone that project[was written by other programmer and can be used as framework] and drag and drop to your project ??"
感谢您的回答
您需要考虑的几件事是:
在新版本发布时更新您的依赖项。
正在更新多个平台的依赖项。
相互依赖的框架和依赖框架的不同框架版本。
基本上,您花在维护项目依赖项上的时间会随着项目的增长而增加。依赖管理器可让您避免所有这些不必要且无聊的工作。 使用 DM 而不仅仅是导入框架还有很多其他原因。更多关于你可以找到 here. And here.
为什么图书馆是你的朋友
While you aren’t strictly required to use third-party libraries or frameworks, they can definitely save you a lot of time and let you focus on polishing your app instead of typing out countless lines of code that you simply don’t need to write.
You can use third-party frameworks and libraries without a dependency manager too, and you can get hands-on tutorials about them right here on this site. For example, there’s our Alamofire tutorial, and our SwiftyJSON tutorial.
Without a dependency manager, you simply add each library’s code to your project manually. However, this approach has several disadvantages:
- Updating a library to a new version can be difficult, especially if several libraries must be updated together because one depends on another.
- Including a library in your project makes it tempting to make local changes to the code, making it harder to update to a newer version later.
- Determining the current versions of libraries used in your app can be hard to do, especially if you don’t proactively keep track of them.
- Finding new libraries can be difficult without a central location to see all the available libraries.
- CocoaPods helps you overcome all of these issues and more. It fetches library code, resolves dependencies between libraries, helps you search for and discover new libraries, and even sets up the right environment to build your project with minimum hassle.
礼貌 https://www.raywenderlich.com/97014/use-cocoapods-with-swift
在某些时候您可能想使用 3rd 方代码来获得额外的功能或其他东西,您可以复制源代码,但将来您将如何更新它?继续应对!!
另外,您的某些第 3 方代码可能依赖于其他第 3 部分代码,如果您复制它两次,您将得到重复的符号。
依赖管理器为您处理所有这一切。
我的建议是使用 Carthage 或子模块,但不要使用 CocoPods,任何接触项目文件的东西都不是 Apple 的好习惯。