xcode 如何创建 Cartfile?或者轻松地向您的应用程序添加框架?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31739294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:35:31  来源:igfitidea点击:

How do you create a Cartfile? Or easily add frameworks to your app?

iosxcodeswiftframeworkscarthage

提问by trixmasta

I'm trying to learn about frameworks and how to use them in my Swift app. I'm a beginner at Swift, I understand OOP concepts but am completely new to handling libraries and frameworks.

我正在尝试了解框架以及如何在我的 Swift 应用程序中使用它们。我是 Swift 的初学者,我了解 OOP 概念,但对处理库和框架是全新的。

I want to use frameworks like SwiftyJSON, Alamofire, and plenty more but want to use them in the simplest way possible. I found out that Carthage is the easiest way to update these into your project. However I haven't found a single user-friendly guide or tutorial on using this! I read the documentation here (https://github.com/Carthage/Carthage/blob/master/README.md) but it was very confusing for me. I am completely stuck at creating a Cartfile.

我想使用 SwiftyJSON、Alamofire 等框架,但想以最简单的方式使用它们。我发现 Carthage 是将这些更新到您的项目中的最简单方法。但是,我还没有找到有关使用它的单一用户友好指南或教程!我在这里阅读了文档(https://github.com/Carthage/Carthage/blob/master/README.md),但这对我来说非常混乱。我完全坚持创建 Cartfile。

How do you create a Cartfile? Where should it be located?

如何创建 Cartfile?它应该位于哪里?

After that I understand the commands to put in it, but I'm stuck at creating it and understanding the fundementals.

在那之后,我理解了放入它的命令,但我坚持创建它并理解基本原理。

回答by Jakub Vano

Cartfile is simple plain-text file, that should be located in the same folder as your *.xcodeprojfile.

Cartfile 是简单的纯文本文件,它应该与您的*.xcodeproj文件位于同一文件夹中。

One way of creating it is via terminal:

创建它的一种方法是通过终端:

$ cd <Path_to_the_project_folder>
$ touch Cartfile
$ open Cartfile -a Xcode